mirror of
https://github.com/Readarr/Readarr
synced 2026-05-08 21:13:58 +02:00
Fixed: Exception when parsing Quality in release title with colon
Signed-off-by: Robin Dadswell <robin@dadswell.email>
This commit is contained in:
parent
e4ca35d2d2
commit
36685edd49
2 changed files with 13 additions and 1 deletions
|
|
@ -72,6 +72,17 @@ public static bool PathEquals(this string firstPath, string secondPath, StringCo
|
||||||
return string.Equals(firstPath.CleanFilePath(), secondPath.CleanFilePath(), comparison.Value);
|
return string.Equals(firstPath.CleanFilePath(), secondPath.CleanFilePath(), comparison.Value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static string GetPathExtension(this string path)
|
||||||
|
{
|
||||||
|
var idx = path.LastIndexOf('.');
|
||||||
|
if (idx == -1 || idx == path.Length - 1)
|
||||||
|
{
|
||||||
|
return string.Empty;
|
||||||
|
}
|
||||||
|
|
||||||
|
return path.Substring(idx);
|
||||||
|
}
|
||||||
|
|
||||||
public static string GetRelativePath(this string parentPath, string childPath)
|
public static string GetRelativePath(this string parentPath, string childPath)
|
||||||
{
|
{
|
||||||
if (!parentPath.IsParentPath(childPath))
|
if (!parentPath.IsParentPath(childPath))
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using NLog;
|
using NLog;
|
||||||
|
using NzbDrone.Common.Disk;
|
||||||
using NzbDrone.Common.Extensions;
|
using NzbDrone.Common.Extensions;
|
||||||
using NzbDrone.Common.Instrumentation;
|
using NzbDrone.Common.Instrumentation;
|
||||||
using NzbDrone.Core.MediaFiles;
|
using NzbDrone.Core.MediaFiles;
|
||||||
|
|
@ -94,7 +95,7 @@ public static QualityModel ParseQuality(string name, string desc = null)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
result.Quality = MediaFileExtensions.GetQualityForExtension(Path.GetExtension(name));
|
result.Quality = MediaFileExtensions.GetQualityForExtension(name.GetPathExtension());
|
||||||
result.QualityDetectionSource = QualityDetectionSource.Extension;
|
result.QualityDetectionSource = QualityDetectionSource.Extension;
|
||||||
}
|
}
|
||||||
catch (ArgumentException)
|
catch (ArgumentException)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue