added readability check for fs.access
This commit is contained in:
+2
-2
@@ -45,7 +45,7 @@ module.exports = (config) => {
|
||||
|
||||
const showError = (resPath, code, res) => {
|
||||
const errorPath = path.join(config['data_dir'], config['home']['error']);
|
||||
fs.access(errorPath, (err) => {
|
||||
fs.access(errorPath, fs.constants.R_OK, (err) => {
|
||||
if (err)
|
||||
res.sendStatus(code);
|
||||
else
|
||||
@@ -55,7 +55,7 @@ module.exports = (config) => {
|
||||
|
||||
app.get('/', (req, res) => {
|
||||
const homePath = `${config['data_dir']}/${config['home']['index']}`;
|
||||
fs.access(homePath,(err)=>{
|
||||
fs.access(homePath, fs.constants.R_OK, (err) => {
|
||||
if (err)
|
||||
showError(req.path, 404, res);
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user