fix url decode

This commit is contained in:
monoid 2023-01-06 18:20:26 +09:00
parent 2726e2abaf
commit d959076d28
2 changed files with 2 additions and 2 deletions

View File

@ -36,7 +36,7 @@ async function GET(req: Request, ctx: HandlerContext): Promise<Response>{
}
}
const url = new URL(req.url);
const path = removePrefixFromPathname(url.pathname, "/dir");
const path = removePrefixFromPathname(decodeURI(url.pathname), "/dir");
const stat = await Deno.stat(path);
if (stat.isDirectory){
const filesIter = await Deno.readDir(path);

View File

@ -4,7 +4,7 @@ import {removePrefixFromPathname} from "../../util/util.ts";
export async function GET(req: Request, ctx: HandlerContext): Promise<Response> {
const url = new URL(req.url);
const path = removePrefixFromPathname(url.pathname, "/fs");
const path = removePrefixFromPathname(decodeURI(url.pathname), "/fs");
// if auth is required, check if the user is logged in.
// if not, return a 401.
const authRequired = Deno.env.get("AUTH_REQUIRED") === "true";