[Dev] Add URI decoding to server

This commit is contained in:
Ducko 2021-03-09 16:17:44 +00:00 committed by フズキ
parent 4268f099b5
commit a917e6f9a5
No known key found for this signature in database
GPG Key ID: AD7750AB4625F1DD
1 changed files with 3 additions and 2 deletions

View File

@ -51,11 +51,12 @@ const parcelOptions = {
};
createServer((req, res) => {
const basedPath = `${distDir}${req.url.split('?').shift().replace(/\.\./g, '')}`;
const goodUrl = decodeURI(req.url);
const basedPath = `${distDir}${goodUrl.split('?').shift().replace(/\.\./g, '')}`;
let contentType = 'text/plain';
switch (req.url.split('.').pop()) {
switch (goodUrl.split('.').pop()) {
case 'js':
contentType = 'text/javascript';
break;