Commit 4b8f5754 authored by Julien Fontanet's avatar Julien Fontanet

fix(rmdir): dont test existence

Test pre-condition can leads to race-conditions.
Also current code was hiding SMB error.
parent e3fd38fa
......@@ -18,14 +18,8 @@ var SMB2Forge = require('../tools/smb2-forge'),
module.exports = function rmdir(path, cb) {
var connection = this;
connection.exists(path, function(err, exists) {
if (err) cb && cb(err);
else if (exists) {
// SMB2 open file
SMB2Request('open_folder', { path: path }, connection, function(
err,
file
) {
SMB2Request('open_folder', { path: path }, connection, function(err, file) {
if (err) cb && cb(err);
// SMB2 query directory
else
......@@ -47,8 +41,4 @@ module.exports = function rmdir(path, cb) {
}
);
});
} else {
cb(new Error('Folder does not exists'));
}
});
};
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment