Throw HttpException when tvdb sends us crap data

pull/3835/head
cvium 4 years ago
parent b7f3906446
commit 23dfadd430

@ -4,6 +4,8 @@ using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Net;
using System.Net.Mime;
using System.Threading;
using System.Threading.Tasks;
using Jellyfin.Data.Entities;
@ -22,6 +24,7 @@ using MediaBrowser.Model.Configuration;
using MediaBrowser.Model.Entities;
using MediaBrowser.Model.Events;
using MediaBrowser.Model.IO;
using MediaBrowser.Model.Net;
using MediaBrowser.Model.Providers;
using Microsoft.Extensions.Logging;
using Priority_Queue;
@ -169,6 +172,15 @@ namespace MediaBrowser.Providers.Manager
}
}
// thetvdb will sometimes serve a rubbish 404 html page with a 200 OK code, because reasons...
if (response.ContentType.Equals(MediaTypeNames.Text.Html, StringComparison.OrdinalIgnoreCase))
{
throw new HttpException("Invalid image received.")
{
StatusCode = HttpStatusCode.NotFound
};
}
await SaveImage(item, response.Content, response.ContentType, type, imageIndex, cancellationToken).ConfigureAwait(false);
}

Loading…
Cancel
Save