diff --git a/Duplicati/Library/Main/RSyncDir.cs b/Duplicati/Library/Main/RSyncDir.cs index aa5628f34..eab7ddae8 100644 --- a/Duplicati/Library/Main/RSyncDir.cs +++ b/Duplicati/Library/Main/RSyncDir.cs @@ -1182,14 +1182,21 @@ namespace Duplicati.Library.Main.RSync /// A full path, based on the relative path private static string GetFullPathFromRelname(string[] sourcefolders, string relpath) { - if (sourcefolders.Length == 1) - return System.IO.Path.Combine(sourcefolders[0], relpath); - else + try { - int ix = relpath.IndexOf(System.IO.Path.DirectorySeparatorChar); - //In some versions, Duplicati incorrectly writes the folder name without a trailing slash - int pos = ix < 0 ? int.Parse(relpath) : int.Parse(relpath.Substring(0, ix)); - return System.IO.Path.Combine(sourcefolders[Math.Min(sourcefolders.Length - 1, pos)], relpath.Substring(ix + 1)); + if (sourcefolders.Length == 1) + return System.IO.Path.Combine(sourcefolders[0], relpath); + else + { + int ix = relpath.IndexOf(System.IO.Path.DirectorySeparatorChar); + //In some versions, Duplicati incorrectly writes the folder name without a trailing slash + int pos = ix < 0 ? int.Parse(relpath) : int.Parse(relpath.Substring(0, ix)); + return System.IO.Path.Combine(sourcefolders[Math.Min(sourcefolders.Length - 1, pos)], relpath.Substring(ix + 1)); + } + } + catch (Exception ex) + { + throw new ArgumentException(string.Format(Strings.RSyncDir.InvalidRelFilenameError, relpath, string.Join(Environment.NewLine, sourcefolders), ex.Message) , ex); } } diff --git a/Duplicati/Library/Main/Strings/RSyncDir.Designer.cs b/Duplicati/Library/Main/Strings/RSyncDir.Designer.cs index 03621e2f4..c7a7142b2 100644 --- a/Duplicati/Library/Main/Strings/RSyncDir.Designer.cs +++ b/Duplicati/Library/Main/Strings/RSyncDir.Designer.cs @@ -1,7 +1,7 @@ //------------------------------------------------------------------------------ // // This code was generated by a tool. -// Runtime Version:4.0.30319.237 +// Runtime Version:4.0.30319.544 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. @@ -207,6 +207,15 @@ namespace Duplicati.Library.Main.Strings { } } + /// + /// Looks up a localized string similar to Invalid filename detected: {0}, source folders: {1}, error message: {2}. + /// + internal static string InvalidRelFilenameError { + get { + return ResourceManager.GetString("InvalidRelFilenameError", resourceCulture); + } + } + /// /// Looks up a localized string similar to The timestamp information for file {0} could not be read: {1}. /// @@ -288,6 +297,15 @@ namespace Duplicati.Library.Main.Strings { } } + /// + /// Looks up a localized string similar to The symlink information for {0} could not be read: {1}. + /// + internal static string SymlinkReadError { + get { + return ResourceManager.GetString("SymlinkReadError", resourceCulture); + } + } + /// /// Looks up a localized string similar to Failed to dispose USN helper: {0}. /// @@ -332,14 +350,5 @@ namespace Duplicati.Library.Main.Strings { return ResourceManager.GetString("UsnNumberingFaultWarning", resourceCulture); } } - - /// - /// Looks up a localized string similar to The symlink information for {0} could not be read: {1}. - /// - internal static string SymlinkReadError { - get { - return ResourceManager.GetString("SymlinkReadError", resourceCulture); - } - } -} + } } diff --git a/Duplicati/Library/Main/Strings/RSyncDir.resx b/Duplicati/Library/Main/Strings/RSyncDir.resx index a1392cb09..bd02454ee 100644 --- a/Duplicati/Library/Main/Strings/RSyncDir.resx +++ b/Duplicati/Library/Main/Strings/RSyncDir.resx @@ -213,4 +213,7 @@ Error message: {1} The symlink information for {0} could not be read: {1} + + Invalid filename detected: {0}, source folders: {1}, error message: {2} + \ No newline at end of file