system-prompts-and-models-o.../unified-ai-platform/node_modules/@hapi/hoek/lib/escapeHeaderAttribute.js
dopeuni444 ae726301f8 KI
KJ
2025-08-06 11:08:49 +04:00

17 lines
474 B
JavaScript

'use strict';
const Assert = require('./assert');
const internals = {};
module.exports = function (attribute) {
// Allowed value characters: !#$%&'()*+,-./:;<=>?@[]^_`{|}~ and space, a-z, A-Z, 0-9, \, "
Assert(/^[ \w\!#\$%&'\(\)\*\+,\-\.\/\:;<\=>\?@\[\]\^`\{\|\}~\"\\]*$/.test(attribute), 'Bad attribute value (' + attribute + ')');
return attribute.replace(/\\/g, '\\\\').replace(/\"/g, '\\"'); // Escape quotes and slash
};