Permalink
Browse files

Fixed unecrypted temporary files stored for upload were not removed.

  • Loading branch information...
kenkendk committed Jun 20, 2018
1 parent 32b4850 commit be6093b7a61eca8152cb4babcc61011461be66fb
Showing with 13 additions and 7 deletions.
  1. +13 −7 Duplicati/Library/Main/Operation/Common/BackendHandler.cs
@@ -117,7 +117,7 @@ public async Task Encrypt(Options options)
using(var enc = DynamicLoader.EncryptionLoader.GetModule(options.EncryptionModule, options.Passphrase, options.RawOptions))
enc.Encrypt(this.LocalFilename, tempfile);

await this.DeleteLocalFile();
this.DeleteLocalFile();

this.LocalTempfile = tempfile;
this.Hash = null;
@@ -146,12 +146,18 @@ public bool UpdateHashAndSize(Options options)
return false;
}

public async Task DeleteLocalFile()
public void DeleteLocalFile()
{
if (this.LocalTempfile != null)
try { this.LocalTempfile.Dispose(); }
catch (Exception ex) { Logging.Log.WriteWarningMessage(LOGTAG, "DeleteTemporaryFileError", ex, "Failed to dispose temporary file: {0}", this.LocalTempfile); }
finally { this.LocalTempfile = null; }
{
try
{
this.LocalTempfile.Protected = false;
this.LocalTempfile.Dispose();
}
catch (Exception ex) { Logging.Log.WriteWarningMessage(LOGTAG, "DeleteTemporaryFileError", ex, "Failed to dispose temporary file: {0}", this.LocalTempfile); }
finally { this.LocalTempfile = null; }
}
}
}

@@ -439,7 +445,7 @@ private async Task<bool> DoPut(FileEntryItem item, bool updatedHash = false)
if (m_options.Dryrun)
{
Logging.Log.WriteDryrunMessage(LOGTAG, "WouldUploadVolume", "Would upload volume: {0}, size: {1}", item.RemoteFilename, Library.Utility.Utility.FormatSizeString(new FileInfo(item.LocalFilename).Length));
await item.DeleteLocalFile();
item.DeleteLocalFile();
return true;
}

@@ -475,7 +481,7 @@ private async Task<bool> DoPut(FileEntryItem item, bool updatedHash = false)
throw new Exception(string.Format("List verify failed for file: {0}, size was {1} but expected to be {2}", f.Name, f.Size, item.Size));
}

await item.DeleteLocalFile();
item.DeleteLocalFile();
await m_database.CommitTransactionAsync("CommitAfterUpload");

return true;

1 comment on commit be6093b

@duplicatibot

This comment has been minimized.

Copy link

duplicatibot commented on be6093b Jun 20, 2018

This commit has been mentioned on Duplicati. There might be relevant details there:

https://forum.duplicati.com/t/duplicati-temp-dup-xxxx-files-not-being-deleted/3614/21

Please sign in to comment.