Commit 8b587acb authored by wescoeur's avatar wescoeur Committed by Fabrice Marsaud

Rename request should not overwrite data.

parent 889a7bdd
var bigint = require('../tools/bigint') var bigint = require('../tools/bigint')
, SMB2Forge = require('../tools/smb2-forge') var SMB2Request = require('../tools/smb2-forge').request
, SMB2Request = SMB2Forge.request var FILE_OPEN_IF = require('../structures/constants').FILE_OPEN_IF
;
/* /*
* rename * rename
...@@ -24,7 +21,7 @@ module.exports = function(oldPath, newPath, cb){ ...@@ -24,7 +21,7 @@ module.exports = function(oldPath, newPath, cb){
// SMB2 open the folder / file // SMB2 open the folder / file
SMB2Request('open_folder', {path:oldPath}, connection, function(err, file){ SMB2Request('open_folder', {path:oldPath}, connection, function(err, file){
if(err) SMB2Request('create', {path:oldPath}, connection, function(err, file){ if (err) SMB2Request('create', { path: oldPath, createDisposition: FILE_OPEN_IF }, connection, function (err, file) {
if(err) cb && cb(err); if(err) cb && cb(err);
else rename(connection, file, newPath, cb); else rename(connection, file, newPath, cb);
}); });
......
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