🐛 Fix: fix a bug of file server when the request path is url encoded

This commit is contained in:
萌萌哒赫萝 2023-07-18 00:03:59 -07:00
parent c1698e8661
commit 48b13b20fe

View File

@ -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) {