1
0
mirror of https://github.com/Sonarr/Sonarr.git synced 2024-12-25 02:30:20 +02:00

Fixed: Prevent exception when grabbing unparsable release

Closes #7494
This commit is contained in:
Mark McDowall 2024-12-17 17:05:39 -08:00
parent edfc12e27a
commit b1896b4c74
No known key found for this signature in database
3 changed files with 13 additions and 3 deletions

View File

@ -94,6 +94,11 @@ public List<SceneMapping> FindByTvdbId(int tvdbId)
public SceneMapping FindSceneMapping(string seriesTitle, string releaseTitle, int sceneSeasonNumber) public SceneMapping FindSceneMapping(string seriesTitle, string releaseTitle, int sceneSeasonNumber)
{ {
if (seriesTitle.IsNullOrWhiteSpace())
{
return null;
}
var mappings = FindMappings(seriesTitle, releaseTitle); var mappings = FindMappings(seriesTitle, releaseTitle);
if (mappings == null) if (mappings == null)

View File

@ -836,6 +836,11 @@ public static string ParseSeriesName(string title)
public static string CleanSeriesTitle(this string title) public static string CleanSeriesTitle(this string title)
{ {
if (title.IsNullOrWhiteSpace())
{
return title;
}
// If Title only contains numbers return it as is. // If Title only contains numbers return it as is.
if (long.TryParse(title, out _)) if (long.TryParse(title, out _))
{ {

View File

@ -127,7 +127,7 @@ public async Task<object> DownloadRelease([FromBody] ReleaseResource release)
if (episodes.Empty()) if (episodes.Empty())
{ {
throw new NzbDroneClientException(HttpStatusCode.NotFound, "Unable to parse episodes in the release"); throw new NzbDroneClientException(HttpStatusCode.NotFound, "Unable to parse episodes in the release, will need to be manually provided");
} }
remoteEpisode.Series = series; remoteEpisode.Series = series;
@ -135,7 +135,7 @@ public async Task<object> DownloadRelease([FromBody] ReleaseResource release)
} }
else else
{ {
throw new NzbDroneClientException(HttpStatusCode.NotFound, "Unable to find matching series and episodes"); throw new NzbDroneClientException(HttpStatusCode.NotFound, "Unable to find matching series and episodes, will need to be manually provided");
} }
} }
else if (remoteEpisode.Episodes.Empty()) else if (remoteEpisode.Episodes.Empty())
@ -154,7 +154,7 @@ public async Task<object> DownloadRelease([FromBody] ReleaseResource release)
if (remoteEpisode.Episodes.Empty()) if (remoteEpisode.Episodes.Empty())
{ {
throw new NzbDroneClientException(HttpStatusCode.NotFound, "Unable to parse episodes in the release"); throw new NzbDroneClientException(HttpStatusCode.NotFound, "Unable to parse episodes in the release, will need to be manually provided");
} }
await _downloadService.DownloadReport(remoteEpisode, release.DownloadClientId); await _downloadService.DownloadReport(remoteEpisode, release.DownloadClientId);