Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/duplicati/duplicati.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKai <nospam@kaigrabfelder.de>2020-10-03 15:09:50 +0300
committerKai <nospam@kaigrabfelder.de>2020-10-03 15:09:50 +0300
commit8e3a52654b276838819b83d98fb0ed84c79b4fb8 (patch)
tree32eb32cce55cd311a7e4e958f410ff3227db6e01 /Duplicati/Library
parentfcc44eacafe2f575e71c28670ec18995d10c1469 (diff)
Update RestoreHandler.cs
fixed #4315 by adding catching of exceptions when creating empty files Not sure if it is ok to create WARN messages or if it should be ERROR messages instead
Diffstat (limited to 'Duplicati/Library')
-rw-r--r--Duplicati/Library/Main/Operation/RestoreHandler.cs18
1 files changed, 14 insertions, 4 deletions
diff --git a/Duplicati/Library/Main/Operation/RestoreHandler.cs b/Duplicati/Library/Main/Operation/RestoreHandler.cs
index ee09e1881..8c101b5a5 100644
--- a/Duplicati/Library/Main/Operation/RestoreHandler.cs
+++ b/Duplicati/Library/Main/Operation/RestoreHandler.cs
@@ -415,11 +415,21 @@ namespace Duplicati.Library.Main.Operation
// Restore empty files. They might not have any blocks so don't appear in any volume.
foreach (var file in database.GetFilesToRestore(true).Where(item => item.Length == 0))
{
- SystemIO.IO_OS.DirectoryCreate(SystemIO.IO_OS.PathGetDirectoryName(file.Path));
+ Logging.Log.WriteProfilingMessage(LOGTAG, "RestoreFile", "restoring empty file \"{0}\"", file.Path);
- // Just create the file and close it right away, empty statement is intentional.
- using (SystemIO.IO_OS.FileCreate(file.Path))
+ try
+ {
+ SystemIO.IO_OS.DirectoryCreate(SystemIO.IO_OS.PathGetDirectoryName(file.Path));
+ // Just create the file and close it right away, empty statement is intentional.
+ using (SystemIO.IO_OS.FileCreate(file.Path))
+ {
+ }
+ }
+ catch (Exception ex)
{
+ Logging.Log.WriteWarningMessage(LOGTAG, "RestoreFileFailed", ex, "Failed to restore empty file: \"{0}\", message: {1}", file.Path, ex.Message);
+ if (ex is System.Threading.ThreadAbortException)
+ throw;
}
}
@@ -472,7 +482,7 @@ namespace Duplicati.Library.Main.Operation
catch (Exception ex)
{
fileErrors++;
- Logging.Log.WriteErrorMessage(LOGTAG, "RestoreFileFailed", ex, ex.Message);
+ Logging.Log.WriteErrorMessage(LOGTAG, "RestoreFileFailed", ex, "Failed to restore file: \"{0}\". Error message was: {1}", file.Path, ex.Message);
if (ex is System.Threading.ThreadAbortException)
throw;
}