diff options
| author | theguymadmax <171496228+theguymadmax@users.noreply.github.com> | 2025-12-03 14:04:17 -0500 |
|---|---|---|
| committer | Bond_009 <bond.009@outlook.com> | 2025-12-03 14:04:17 -0500 |
| commit | e4daaf0d8330ab1e8abadcb927b03b5ded08895a (patch) | |
| tree | 124bc595ebe69185bb1264b5935ee97d8e622af9 /Emby.Server.Implementations/IO/ManagedFileSystem.cs | |
| parent | 691c194152df841e4ebd753b1c3a0d75e5d13e79 (diff) | |
Backport pull request #15548 from jellyfin/release-10.11.z
Fix NullReferenceException in filesystem path comparison
Original-merge: 5ae444d96d473ba42c4a812c3f366b0faa6ebef4
Merged-by: crobibero <cody@robibe.ro>
Backported-by: Bond_009 <bond.009@outlook.com>
Diffstat (limited to 'Emby.Server.Implementations/IO/ManagedFileSystem.cs')
| -rw-r--r-- | Emby.Server.Implementations/IO/ManagedFileSystem.cs | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/Emby.Server.Implementations/IO/ManagedFileSystem.cs b/Emby.Server.Implementations/IO/ManagedFileSystem.cs index fad97344b..4d68cb444 100644 --- a/Emby.Server.Implementations/IO/ManagedFileSystem.cs +++ b/Emby.Server.Implementations/IO/ManagedFileSystem.cs @@ -497,8 +497,17 @@ namespace Emby.Server.Implementations.IO /// <inheritdoc /> public virtual bool AreEqual(string path1, string path2) { - return Path.TrimEndingDirectorySeparator(path1).Equals( - Path.TrimEndingDirectorySeparator(path2), + if (string.IsNullOrWhiteSpace(path1) || string.IsNullOrWhiteSpace(path2)) + { + return false; + } + + var normalized1 = Path.TrimEndingDirectorySeparator(path1); + var normalized2 = Path.TrimEndingDirectorySeparator(path2); + + return string.Equals( + normalized1, + normalized2, _isEnvironmentCaseInsensitive ? StringComparison.OrdinalIgnoreCase : StringComparison.Ordinal); } |
