mirror of
				https://github.com/node-red/node-red.git
				synced 2025-03-01 10:36:34 +00:00 
			
		
		
		
	Merge pull request #3277 from node-red/debug-path-fix
Add proper error handling for 404 errors when serving debug files
This commit is contained in:
		@@ -280,6 +280,18 @@ module.exports = function(RED) {
 | 
			
		||||
            root: path.join(__dirname,"lib","debug"),
 | 
			
		||||
            dotfiles: 'deny'
 | 
			
		||||
        };
 | 
			
		||||
        res.sendFile(req.params[0], options);
 | 
			
		||||
        try {
 | 
			
		||||
            res.sendFile(
 | 
			
		||||
                req.params[0],
 | 
			
		||||
                options,
 | 
			
		||||
                 err => {
 | 
			
		||||
                    if (err) {
 | 
			
		||||
                        res.sendStatus(404);
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
            )
 | 
			
		||||
        } catch(err) {
 | 
			
		||||
            res.sendStatus(404);
 | 
			
		||||
        }
 | 
			
		||||
    });
 | 
			
		||||
};
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user