Merge pull request #3835 from cvium/fix_tvdb_404_shit_nginx_failure

Throw HttpException when tvdb sends us crap data
pull/3863/head
Bond-009 4 years ago committed by GitHub
commit bacfbbbd58
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -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