mirror of
https://github.com/profullstack/logicsrc.git
synced 2026-08-13 14:37:26 +00:00
Handle malformed static paths (#31)
Co-authored-by: Codex Microtask Operator <codex-microtask@example.com>
This commit is contained in:
parent
774d461db6
commit
d9cf41e5a3
1 changed files with 6 additions and 1 deletions
|
|
@ -48,7 +48,12 @@ createServer((request, response) => {
|
|||
});
|
||||
|
||||
function resolveStaticPath(pathname) {
|
||||
const decodedPath = decodeURIComponent(pathname);
|
||||
let decodedPath;
|
||||
try {
|
||||
decodedPath = decodeURIComponent(pathname);
|
||||
} catch {
|
||||
return null;
|
||||
}
|
||||
const normalizedPath = normalize(decodedPath).replace(/^(\.\.[/\\])+/, "");
|
||||
let candidate = join(distDirectory, normalizedPath);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue