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:
authorKenneth Hsu <kennethhsu@gmail.com>2021-05-14 23:27:09 +0300
committerKenneth Hsu <kennethhsu@gmail.com>2021-05-15 04:34:52 +0300
commit4cc7beea2c9297cfeeb335ffe71b4cc5d1b6d8e9 (patch)
tree80468a7940f8071baacdb79d8821396ab0f9ac02
parent53621c984da5ac4243e0f84a94d77f131ed70257 (diff)
Add test for restoring directory containing problematic filenames.
-rw-r--r--Duplicati/UnitTest/ProblematicPathTests.cs14
1 files changed, 14 insertions, 0 deletions
diff --git a/Duplicati/UnitTest/ProblematicPathTests.cs b/Duplicati/UnitTest/ProblematicPathTests.cs
index be7aed09c..85d3cebd8 100644
--- a/Duplicati/UnitTest/ProblematicPathTests.cs
+++ b/Duplicati/UnitTest/ProblematicPathTests.cs
@@ -274,6 +274,8 @@ namespace Duplicati.UnitTest
}
Dictionary<string, string> restoreOptions = new Dictionary<string, string>(this.TestOptions) {["restore-path"] = this.RESTOREFOLDER};
+
+ // Restore just the file.
using (Controller c = new Controller("file://" + this.TARGETFOLDER, restoreOptions, null))
{
IRestoreResults restoreResults = c.Restore(new[] {filePath});
@@ -283,6 +285,18 @@ namespace Duplicati.UnitTest
string restoreFilePath = SystemIO.IO_OS.PathCombine(this.RESTOREFOLDER, pathComponent);
TestUtils.AssertFilesAreEqual(filePath, restoreFilePath, true, pathComponent);
+ SystemIO.IO_OS.FileDelete(restoreFilePath);
+
+ // Restore the entire directory.
+ string pathSpec = $"[{Util.AppendDirSeparator(this.DATAFOLDER)}.*]";
+ using (Controller c = new Controller("file://" + this.TARGETFOLDER, restoreOptions, null))
+ {
+ IRestoreResults restoreResults = c.Restore(new[] {pathSpec});
+ Assert.AreEqual(0, restoreResults.Errors.Count());
+ Assert.AreEqual(0, restoreResults.Warnings.Count());
+ }
+
+ TestUtils.AssertDirectoryTreesAreEquivalent(this.DATAFOLDER, this.RESTOREFOLDER, true, pathComponent);
}
}
} \ No newline at end of file