From 89cedb89ca09eb81b7ca225edf9a4dff6823ea06 Mon Sep 17 00:00:00 2001 From: Kenneth Skovhede Date: Tue, 2 Sep 2014 18:05:07 +0200 Subject: [PATCH] Fixed handling file://c:\test with the new parser --- Duplicati/Library/Utility/Uri.cs | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/Duplicati/Library/Utility/Uri.cs b/Duplicati/Library/Utility/Uri.cs index d097f6c77..ee11b4e19 100644 --- a/Duplicati/Library/Utility/Uri.cs +++ b/Duplicati/Library/Utility/Uri.cs @@ -143,7 +143,7 @@ namespace Duplicati.Library.Utility path = path.Substring("file://".Length); if (path.IndexOfAny(System.IO.Path.GetInvalidPathChars()) < 0) - try + try { var fp = System.IO.Path.GetFullPath(path); this.Scheme = "file"; @@ -161,12 +161,21 @@ namespace Duplicati.Library.Utility throw new ArgumentException(string.Format(Strings.Uri.UriParseError, url), "url"); } - this.Scheme = m.Groups["scheme"].Value; - this.Host = m.Groups["hostname"].Success ? m.Groups["hostname"].Value : ""; + this.Scheme = m.Groups["scheme"].Value; + var h = m.Groups["hostname"].Success ? m.Groups["hostname"].Value : ""; var p = m.Groups["path"].Success ? m.Groups["path"].Value : ""; if (m.Groups["hostname"].Success && p.StartsWith("/")) - p = p.Substring(1); + p = p.Substring(1); + + // file://c:\test support + if (h.Length == 1 && p.StartsWith(":")) + { + h = h + p; + p = ""; + } + + this.Host = h; this.Path = p; this.Query = m.Groups["query"].Success ? m.Groups["query"].Value : null;