Fix 404 when non-english character presents in URL

master
Kirigaya Kazuto 2019-01-19 22:29:46 +08:00
parent a874a96592
commit 61fd000d8d
1 changed files with 1 additions and 1 deletions

2
app.js
View File

@ -105,7 +105,7 @@ async function RebuildSite() {
async function request_handler(req,res) {
let obj=url.parse(req.url,true)
if(req.method=="GET") {
let normPath=path.normalize(obj.pathname)
let normPath=path.normalize(decodeURI(obj.pathname))
let localPath=path.join(ROOT_DIR,normPath)
try {
let stats=await promisify(fs.stat)(localPath)