[Dev] Add URI decoding to server
This commit is contained in:
parent
4268f099b5
commit
a917e6f9a5
|
@ -51,11 +51,12 @@ const parcelOptions = {
|
||||||
};
|
};
|
||||||
|
|
||||||
createServer((req, res) => {
|
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';
|
let contentType = 'text/plain';
|
||||||
|
|
||||||
switch (req.url.split('.').pop()) {
|
switch (goodUrl.split('.').pop()) {
|
||||||
case 'js':
|
case 'js':
|
||||||
contentType = 'text/javascript';
|
contentType = 'text/javascript';
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in New Issue