mirror of
https://github.com/NuSkooler/enigma-bbs.git
synced 2025-06-11 07:04:32 +02:00
Fix crash when file does not exist... and 404 page contents don't exist :)
This commit is contained in:
parent
6285193545
commit
6a684266a2
1 changed files with 2 additions and 1 deletions
|
@ -160,10 +160,11 @@ exports.getModule = class WebServerModule extends ServerModule {
|
||||||
routeStaticFile(req, resp) {
|
routeStaticFile(req, resp) {
|
||||||
const fileName = req.url.substr(req.url.indexOf('/', 1));
|
const fileName = req.url.substr(req.url.indexOf('/', 1));
|
||||||
const filePath = paths.join(Config.contentServers.web.staticRoot, fileName);
|
const filePath = paths.join(Config.contentServers.web.staticRoot, fileName);
|
||||||
|
const self = this;
|
||||||
|
|
||||||
fs.stat(filePath, (err, stats) => {
|
fs.stat(filePath, (err, stats) => {
|
||||||
if(err) {
|
if(err) {
|
||||||
return this.respondWithError(resp, 404, 'File not found.', 'File Not Found');
|
return self.respondWithError(resp, 404, 'File not found.', 'File Not Found');
|
||||||
}
|
}
|
||||||
|
|
||||||
const headers = {
|
const headers = {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue