Skip to content

Commit a3e49e2

Browse files
authored
Fix: Fixed ArgumentException in PathNormalization.NormalizePath (#15786)
1 parent 8190817 commit a3e49e2

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/Files.App/Helpers/PathNormalization.cs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,15 @@ public static string NormalizePath(string path)
4444

4545
try
4646
{
47-
return Path.GetFullPath(new Uri(path).LocalPath)
47+
var pathUri = new Uri(path).LocalPath;
48+
if (string.IsNullOrEmpty(pathUri))
49+
return path;
50+
51+
return Path.GetFullPath(pathUri)
4852
.TrimEnd(Path.DirectorySeparatorChar, Path.AltDirectorySeparatorChar)
4953
.ToUpperInvariant();
5054
}
51-
catch (UriFormatException ex)
55+
catch (Exception ex) when (ex is UriFormatException || ex is ArgumentException)
5256
{
5357
App.Logger.LogWarning(ex, path);
5458
return path;

0 commit comments

Comments
 (0)