Update issue #707

Status: Fixed

Added guard to catch and report offending filenames.

git-svn-id: https://duplicati.googlecode.com/svn/branches/1.3.x@1465 59da171f-624f-0410-aa54-27559c288bec
This commit is contained in:
kenneth@hexad.dk
2012-10-08 18:46:51 +00:00
parent 68d77d7237
commit 447b7abe77
3 changed files with 37 additions and 18 deletions
+14 -7
View File
@@ -1182,14 +1182,21 @@ namespace Duplicati.Library.Main.RSync
/// <returns>A full path, based on the relative path</returns>
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);
}
}
+20 -11
View File
@@ -1,7 +1,7 @@
//------------------------------------------------------------------------------
// <auto-generated>
// 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 {
}
}
/// <summary>
/// Looks up a localized string similar to Invalid filename detected: {0}, source folders: {1}, error message: {2}.
/// </summary>
internal static string InvalidRelFilenameError {
get {
return ResourceManager.GetString("InvalidRelFilenameError", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to The timestamp information for file {0} could not be read: {1}.
/// </summary>
@@ -288,6 +297,15 @@ namespace Duplicati.Library.Main.Strings {
}
}
/// <summary>
/// Looks up a localized string similar to The symlink information for {0} could not be read: {1}.
/// </summary>
internal static string SymlinkReadError {
get {
return ResourceManager.GetString("SymlinkReadError", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Failed to dispose USN helper: {0}.
/// </summary>
@@ -332,14 +350,5 @@ namespace Duplicati.Library.Main.Strings {
return ResourceManager.GetString("UsnNumberingFaultWarning", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to The symlink information for {0} could not be read: {1}.
/// </summary>
internal static string SymlinkReadError {
get {
return ResourceManager.GetString("SymlinkReadError", resourceCulture);
}
}
}
}
}
@@ -213,4 +213,7 @@ Error message: {1}</value>
<data name="SymlinkReadError" xml:space="preserve">
<value>The symlink information for {0} could not be read: {1}</value>
</data>
<data name="InvalidRelFilenameError" xml:space="preserve">
<value>Invalid filename detected: {0}, source folders: {1}, error message: {2}</value>
</data>
</root>