From d959076d284f6208dc46239cea065a3e4aa0d3cb Mon Sep 17 00:00:00 2001 From: monoid Date: Fri, 6 Jan 2023 18:20:26 +0900 Subject: [PATCH] fix url decode --- routes/dir/[...path].tsx | 2 +- routes/fs/[...path].ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/routes/dir/[...path].tsx b/routes/dir/[...path].tsx index 67eb82e..c8d8a4b 100644 --- a/routes/dir/[...path].tsx +++ b/routes/dir/[...path].tsx @@ -36,7 +36,7 @@ async function GET(req: Request, ctx: HandlerContext): Promise{ } } 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); diff --git a/routes/fs/[...path].ts b/routes/fs/[...path].ts index 8741b0d..fdd91c7 100644 --- a/routes/fs/[...path].ts +++ b/routes/fs/[...path].ts @@ -4,7 +4,7 @@ import {removePrefixFromPathname} from "../../util/util.ts"; export async function GET(req: Request, ctx: HandlerContext): Promise { 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";