From 48b13b20fec99d59886280f9fd938dd3ff198ba3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=90=8C=E8=90=8C=E5=93=92=E8=B5=AB=E8=90=9D?= Date: Tue, 18 Jul 2023 00:03:59 -0700 Subject: [PATCH] :bug: Fix: fix a bug of file server when the request path is url encoded --- src/main/fileServer/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/fileServer/index.ts b/src/main/fileServer/index.ts index 34f9470e..341a86de 100644 --- a/src/main/fileServer/index.ts +++ b/src/main/fileServer/index.ts @@ -12,7 +12,7 @@ const serverPort = 36699 export function startFileServer () { const server = http.createServer((req, res) => { const requestPath = req.url?.split('?')[0] - const filePath = path.join(imgFilePath, requestPath!) + const filePath = path.join(imgFilePath, decodeURIComponent(requestPath as string)) fs.readFile(filePath, (err, data) => { if (err) {