From 101cc09de2195e2b3092d70b9168d3df5379598f Mon Sep 17 00:00:00 2001 From: Yair <39923744+yaira2@users.noreply.github.com> Date: Wed, 10 Jul 2024 12:20:39 -0400 Subject: [PATCH 1/2] Fix: Fixed ArgumentException in PathNormalization.NormalizePath --- src/Files.App/Helpers/PathNormalization.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Files.App/Helpers/PathNormalization.cs b/src/Files.App/Helpers/PathNormalization.cs index f87805ec9852..cc6627c54a64 100644 --- a/src/Files.App/Helpers/PathNormalization.cs +++ b/src/Files.App/Helpers/PathNormalization.cs @@ -48,7 +48,7 @@ public static string NormalizePath(string path) .TrimEnd(Path.DirectorySeparatorChar, Path.AltDirectorySeparatorChar) .ToUpperInvariant(); } - catch (UriFormatException ex) + catch (Exception ex) when (ex is UriFormatException || ex is ArgumentException) { App.Logger.LogWarning(ex, path); return path; From e76d4d792c6123ddcbe915685b6e04162cfe0025 Mon Sep 17 00:00:00 2001 From: Yair <39923744+yaira2@users.noreply.github.com> Date: Wed, 10 Jul 2024 12:22:20 -0400 Subject: [PATCH 2/2] Update PathNormalization.cs --- src/Files.App/Helpers/PathNormalization.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Files.App/Helpers/PathNormalization.cs b/src/Files.App/Helpers/PathNormalization.cs index cc6627c54a64..c91c1ab6d1e3 100644 --- a/src/Files.App/Helpers/PathNormalization.cs +++ b/src/Files.App/Helpers/PathNormalization.cs @@ -44,7 +44,11 @@ public static string NormalizePath(string path) try { - return Path.GetFullPath(new Uri(path).LocalPath) + var pathUri = new Uri(path).LocalPath; + if (string.IsNullOrEmpty(pathUri)) + return path; + + return Path.GetFullPath(pathUri) .TrimEnd(Path.DirectorySeparatorChar, Path.AltDirectorySeparatorChar) .ToUpperInvariant(); }