fix: path leading slash and remove unused endpoint

This commit is contained in:
Methapon2001 2023-12-15 15:15:50 +07:00
parent d1abd6684e
commit 51528afc74
No known key found for this signature in database
GPG key ID: 849924FEF46BD132
12 changed files with 295 additions and 5364 deletions

View file

@ -111,7 +111,7 @@ async function handleNotFoundRecord(
buffer: Buffer,
stat: { size: number; type: string },
) {
const path = pathname.split("/").slice(0, -1).join("/") + "/";
const path = stripLeadingSlash(pathname.split("/").slice(0, -1).join("/") + "/");
const filename = pathname.split("/").at(-1);
const base64 = Buffer.from(buffer).toString("base64");
@ -175,3 +175,7 @@ async function handleFoundRecord(
return true;
}
function stripLeadingSlash(str: string) {
return str.replace(/^\//, "");
}