mirror of
https://github.com/lidarr/lidarr.git
synced 2025-07-06 04:52:21 -07:00
Include invalid path in exception message when failing to normalize
This commit is contained in:
parent
5bdc119b98
commit
8027ab5d2e
1 changed files with 13 additions and 5 deletions
|
@ -1,3 +1,4 @@
|
||||||
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using NzbDrone.Common.EnvironmentInfo;
|
using NzbDrone.Common.EnvironmentInfo;
|
||||||
using NzbDrone.Common.Extensions;
|
using NzbDrone.Common.Extensions;
|
||||||
|
@ -6,7 +7,7 @@ namespace NzbDrone.Common
|
||||||
{
|
{
|
||||||
public class PathEqualityComparer : IEqualityComparer<string>
|
public class PathEqualityComparer : IEqualityComparer<string>
|
||||||
{
|
{
|
||||||
public static readonly PathEqualityComparer Instance = new PathEqualityComparer();
|
public static readonly PathEqualityComparer Instance = new ();
|
||||||
|
|
||||||
private PathEqualityComparer()
|
private PathEqualityComparer()
|
||||||
{
|
{
|
||||||
|
@ -19,12 +20,19 @@ namespace NzbDrone.Common
|
||||||
|
|
||||||
public int GetHashCode(string obj)
|
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…
Add table
Add a link
Reference in a new issue