%PDF- %PDF-
| Direktori : /home2/rezakur1/www/portfolio/portfolio-rezakurnia/node_modules/astro/dist/core/util/ |
| Current File : /home2/rezakur1/www/portfolio/portfolio-rezakurnia/node_modules/astro/dist/core/util/pathname.js |
function validateAndDecodePathname(pathname) {
let decoded;
try {
decoded = decodeURI(pathname);
} catch (_e) {
throw new Error("Invalid URL encoding");
}
const hasDecoding = decoded !== pathname;
const decodedStillHasEncoding = /%[0-9a-fA-F]{2}/.test(decoded);
if (hasDecoding && decodedStillHasEncoding) {
throw new Error("Multi-level URL encoding is not allowed");
}
return decoded;
}
export {
validateAndDecodePathname
};