diff --git a/src/NzbDrone.Common/Extensions/PathExtensions.cs b/src/NzbDrone.Common/Extensions/PathExtensions.cs index 4e3b4537c..f8d9a160e 100644 --- a/src/NzbDrone.Common/Extensions/PathExtensions.cs +++ b/src/NzbDrone.Common/Extensions/PathExtensions.cs @@ -57,6 +57,17 @@ namespace NzbDrone.Common.Extensions 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) { if (!parentPath.IsParentPath(childPath)) diff --git a/src/NzbDrone.Core/Parser/QualityParser.cs b/src/NzbDrone.Core/Parser/QualityParser.cs index 87fbe90f0..1bc922c30 100644 --- a/src/NzbDrone.Core/Parser/QualityParser.cs +++ b/src/NzbDrone.Core/Parser/QualityParser.cs @@ -4,6 +4,7 @@ using System.Linq; using System.Text.RegularExpressions; using System.Web.UI; using NLog; +using NzbDrone.Common.Disk; using NzbDrone.Common.Extensions; using NzbDrone.Common.Instrumentation; using NzbDrone.Core.MediaFiles; @@ -343,7 +344,7 @@ namespace NzbDrone.Core.Parser { try { - var quality = MediaFileExtensions.GetQualityForExtension(Path.GetExtension(name)); + var quality = MediaFileExtensions.GetQualityForExtension(name.GetPathExtension()); if (quality != Quality.Unknown) {