mirror of
https://github.com/node-red/node-red.git
synced 2025-03-01 10:36:34 +00:00
Remove all uses of fs.exists as it is deprecated
The tests still use it in places - particular localfilesystem tests, but those tests need to be redone with sinon stubbing in place and not rely on real fs operations.
This commit is contained in:
@@ -59,10 +59,13 @@ module.exports = {
|
||||
} else {
|
||||
for (var p=0;p<icon_paths.length;p++) {
|
||||
var iconPath = path.join(icon_paths[p],req.params.icon);
|
||||
if (fs.existsSync(iconPath)) {
|
||||
try {
|
||||
fs.statSync(iconPath);
|
||||
res.sendFile(iconPath);
|
||||
iconCache[req.params.icon] = iconPath;
|
||||
return;
|
||||
} catch(err) {
|
||||
// iconPath doesn't exist
|
||||
}
|
||||
}
|
||||
res.sendFile(defaultIcon);
|
||||
|
Reference in New Issue
Block a user