Include invalid path in exception message when failing to normalize

pull/5414/head v2.11.0.4610
Bogdan 4 weeks ago committed by GitHub
parent 5bdc119b98
commit 8027ab5d2e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -1,3 +1,4 @@
using System;
using System.Collections.Generic;
using NzbDrone.Common.EnvironmentInfo;
using NzbDrone.Common.Extensions;
@ -6,7 +7,7 @@ namespace NzbDrone.Common
{
public class PathEqualityComparer : IEqualityComparer<string>
{
public static readonly PathEqualityComparer Instance = new PathEqualityComparer();
public static readonly PathEqualityComparer Instance = new ();
private PathEqualityComparer()
{
@ -19,12 +20,19 @@ namespace NzbDrone.Common
public int GetHashCode(string obj)
{
if (OsInfo.IsWindows)
try
{
return obj.CleanFilePath().Normalize().ToLower().GetHashCode();
}
if (OsInfo.IsWindows)
{
return obj.CleanFilePath().Normalize().ToLower().GetHashCode();
}
return obj.CleanFilePath().Normalize().GetHashCode();
return obj.CleanFilePath().Normalize().GetHashCode();
}
catch (ArgumentException ex)
{
throw new ArgumentException($"Invalid path: {obj}", ex);
}
}
}
}

Loading…
Cancel
Save