Fix TIC replace bug
This commit is contained in:
parent
939c07f466
commit
8aa878a3ee
|
@ -1879,6 +1879,8 @@ function FTNMessageScanTossModule() {
|
|||
localInfo.fileEntry.fileName = paths.basename(finalPath);
|
||||
}
|
||||
|
||||
localInfo.newPath = dst;
|
||||
|
||||
localInfo.fileEntry.persist(isUpdate, err => {
|
||||
return callback(err, localInfo);
|
||||
});
|
||||
|
@ -1893,6 +1895,12 @@ function FTNMessageScanTossModule() {
|
|||
const oldStorageDir = getAreaStorageDirectoryByTag(localInfo.oldStorageTag);
|
||||
const oldPath = paths.join(oldStorageDir, localInfo.oldFileName);
|
||||
|
||||
// if we updated a file in place, don't delete it!
|
||||
if (localInfo.newPath === oldPath) {
|
||||
Log.trace({path : oldPath}, 'TIC file replaced in place. Nothing to remove.');
|
||||
return callback(null, localInfo);
|
||||
}
|
||||
|
||||
fs.unlink(oldPath, err => {
|
||||
if(err) {
|
||||
Log.warn( { error : err.message, oldPath : oldPath }, 'Failed removing old physical file during TIC replacement');
|
||||
|
|
Loading…
Reference in New Issue