fix: char encoding
This commit is contained in:
parent
2fbd9a3d54
commit
7d8cb59a7a
1 changed files with 3 additions and 2 deletions
|
|
@ -68,12 +68,13 @@ const server = http.createServer(async (req, res) => {
|
||||||
res.setHeader('Content-Type', 'application/json');
|
res.setHeader('Content-Type', 'application/json');
|
||||||
return res.end(JSON.stringify(banks));
|
return res.end(JSON.stringify(banks));
|
||||||
}
|
}
|
||||||
if (!files.includes(req.url)) {
|
let subpath = decodeURIComponent(req.url);
|
||||||
|
if (!files.includes(subpath)) {
|
||||||
res.statusCode = 404;
|
res.statusCode = 404;
|
||||||
res.end('File not found');
|
res.end('File not found');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const filePath = join(directory, req.url);
|
const filePath = join(directory, subpath);
|
||||||
const readStream = createReadStream(filePath);
|
const readStream = createReadStream(filePath);
|
||||||
readStream.on('error', (err) => {
|
readStream.on('error', (err) => {
|
||||||
res.statusCode = 500;
|
res.statusCode = 500;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue