Skip to content

Commit 3232e6f

Browse files
committed
fix: on Windows, the correct file protocol url format is file:///<driver>:/path/to/file_or_dir (#1339)
Signed-off-by: leo <[email protected]>
1 parent 0a6b1fa commit 3232e6f

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

src/Models/Remote.cs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,16 @@ public static bool IsValidURL(string url)
5151
}
5252

5353
var localPath = url;
54-
if (url.StartsWith("file://", StringComparison.Ordinal))
55-
localPath = url.Substring(7);
54+
if (OperatingSystem.IsWindows())
55+
{
56+
if (url.StartsWith("file:///", StringComparison.Ordinal))
57+
localPath = url.Substring(8);
58+
}
59+
else
60+
{
61+
if (url.StartsWith("file://", StringComparison.Ordinal))
62+
localPath = url.Substring(7);
63+
}
5664

5765
return Directory.Exists(localPath);
5866
}

0 commit comments

Comments
 (0)