mirror of
https://github.com/profullstack/logicsrc.git
synced 2026-08-14 23:07:29 +00:00
Handle malformed static paths
This commit is contained in:
parent
8f4691584c
commit
b10efcc1bf
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