Fix 404 when non-english character presents in URL
This commit is contained in:
parent
a874a96592
commit
61fd000d8d
2
app.js
2
app.js
|
@ -105,7 +105,7 @@ async function RebuildSite() {
|
||||||
async function request_handler(req,res) {
|
async function request_handler(req,res) {
|
||||||
let obj=url.parse(req.url,true)
|
let obj=url.parse(req.url,true)
|
||||||
if(req.method=="GET") {
|
if(req.method=="GET") {
|
||||||
let normPath=path.normalize(obj.pathname)
|
let normPath=path.normalize(decodeURI(obj.pathname))
|
||||||
let localPath=path.join(ROOT_DIR,normPath)
|
let localPath=path.join(ROOT_DIR,normPath)
|
||||||
try {
|
try {
|
||||||
let stats=await promisify(fs.stat)(localPath)
|
let stats=await promisify(fs.stat)(localPath)
|
||||||
|
|
Reference in New Issue
Block a user