diff --git a/lib/server/rest.js b/lib/server/rest.js index 4b29f474..fb68fc40 100644 --- a/lib/server/rest.js +++ b/lib/server/rest.js @@ -340,13 +340,13 @@ default: fs.stat(name, function(error, stat) { var getDirContent = main.commander.getDirContent, - isFile = !stat.isDirectory(); + isDir = stat && stat.isDirectory(); if (error) func(error); else - if (isFile) - func(null, null, null, isFile); + if (!isDir) + func(null, null, null, !isDir); else getDirContent(name, function(error, data) { if (!error) {