Include invalid path in exception message when failing to normalize

This commit is contained in:
Bogdan 2025-03-28 09:57:57 +02:00 committed by GitHub
parent 5bdc119b98
commit 8027ab5d2e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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()
{
@ -18,6 +19,8 @@ namespace NzbDrone.Common
}
public int GetHashCode(string obj)
{
try
{
if (OsInfo.IsWindows)
{
@ -26,5 +29,10 @@ namespace NzbDrone.Common
return obj.CleanFilePath().Normalize().GetHashCode();
}
catch (ArgumentException ex)
{
throw new ArgumentException($"Invalid path: {obj}", ex);
}
}
}
}