Files
scriptc/tests/corpus/file-url-percent-decoding.ts
Chris Tate 3af05d9fbc feat(compiler): lower the complete frontend statically
- Complete frontend lowering with zero rejected statements, dynamic islands, or skipped functions.
- Support contextual construction, presence guards, and union record copies used by the compiler.
- Add native CommonJS resolution and cross-platform file URL handling while preserving Node host behavior.
2026-09-28 23:49:13 -05:00

19 lines
924 B
TypeScript

import { fileURLToPath } from "node:url";
for (const tail of [
"ascii", "%20space", "%25percent", "%23hash", "%3Fquestion", "%00nul", "%C3%A9", "%E6%B0%B4", "%F0%9F%98%80",
"%", "%0", "%GG", "%C0%AF", "%80", "%C2", "%E0", "%E0%A0", "%ED%A0%80", "%F0%80%80%80", "%F4%90%80%80",
"%E0%A0x", "%C2%20", "%E0/%2F", "%2F/%E0", "%E0/%5C", "%25E0",
]) {
const value = "file:///C:/work/" + tail;
try { console.log("string", tail, JSON.stringify(fileURLToPath(value))); }
catch (error) {
if (error instanceof Error) console.log("string-error", tail, error.name, error.message, error instanceof URIError);
}
try { console.log("url", tail, JSON.stringify(fileURLToPath(new URL(value)))); }
catch (error) {
if (error instanceof Error) console.log("url-error", tail, error.name, error.message, error instanceof URIError);
}
}
console.log("recovery", fileURLToPath("file:///C:/after/error").endsWith("error"));