diff --git a/lib/server/rest.js b/lib/server/rest.js index d7ced0a8..93fce0da 100644 --- a/lib/server/rest.js +++ b/lib/server/rest.js @@ -48,9 +48,11 @@ }); }, delete : rimraf || function(path, callback) { - dir.isDir(path, function(isDir) { - if (isDir) - fs.rmDir(path, callback); + dir.isDir(path, function(error, isDir) { + if (error) + callback(error); + else if (isDir) + fs.rmdir(path, callback); else fs.unlink(path, callback); });