mirror of
https://github.com/Readarr/Readarr.git
synced 2026-03-07 13:40:02 -05:00
Compare commits
1 Commits
develop
...
sonarr-pul
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
17f28a10d5 |
@@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using FluentAssertions;
|
||||
using Moq;
|
||||
using NUnit.Framework;
|
||||
@@ -316,5 +317,14 @@ namespace NzbDrone.Common.Test
|
||||
result[2].Should().Be(@"Music");
|
||||
result[3].Should().Be(@"Author Title");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_be_equal_with_different_unicode_representations()
|
||||
{
|
||||
var path1 = @"C:\Test\file.mkv".AsOsAgnostic().Normalize(NormalizationForm.FormC);
|
||||
var path2 = @"C:\Test\file.mkv".AsOsAgnostic().Normalize(NormalizationForm.FormD);
|
||||
|
||||
path1.PathEquals(path2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -60,6 +60,10 @@ namespace NzbDrone.Common.Extensions
|
||||
|
||||
public static bool PathEquals(this string firstPath, string secondPath, StringComparison? comparison = null)
|
||||
{
|
||||
// Normalize paths to ensure unicode characters are represented the same way
|
||||
firstPath = firstPath.Normalize();
|
||||
secondPath = secondPath?.Normalize();
|
||||
|
||||
if (!comparison.HasValue)
|
||||
{
|
||||
comparison = DiskProviderBase.PathStringComparison;
|
||||
|
||||
@@ -21,10 +21,10 @@ namespace NzbDrone.Common
|
||||
{
|
||||
if (OsInfo.IsWindows)
|
||||
{
|
||||
return obj.CleanFilePath().ToLower().GetHashCode();
|
||||
return obj.CleanFilePath().Normalize().ToLower().GetHashCode();
|
||||
}
|
||||
|
||||
return obj.CleanFilePath().GetHashCode();
|
||||
return obj.CleanFilePath().Normalize().GetHashCode();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user