[PR #4225] [MERGED] Check response status code before saving images #9958

Closed
opened 2026-02-07 06:11:32 +03:00 by OVERLORD · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/jellyfin/jellyfin/pull/4225
Author: @Spacetech
Created: 9/28/2020
Status: Merged
Merged: 10/5/2020
Merged by: @Bond-009

Base: masterHead: save_image_check


📝 Commits (4)

  • 3ca9b13 Check response status code before saving images
  • 722ec43 remove status code from exception message
  • e9911b7 Use EnsureSuccessStatusCode
  • 25d8d85 Back to HttpException

📊 Changes

1 file changed (+8 additions, -0 deletions)

View changed files

📝 MediaBrowser.Providers/Manager/ProviderManager.cs (+8 -0)

📄 Description

At some point jellyfin downloaded a "poster" that is actually an xml file and ran into trouble getting the image dimensions:

[2020-09-27 14:40:58.006 -07:00] [ERR] [47] Emby.Server.Implementations.Library.LibraryManager: Cannot get image dimensions for "C:\Users\Gary\AppData\Local\jellyfin\metadata\library\ba\ba96d5eae180f07a89aee79d69c228f0\poster.xml"
Non-success codec result: Unimplemented
Jellyfin.Drawing.Skia.SkiaCodecException: Exception of type 'Jellyfin.Drawing.Skia.SkiaCodecException' was thrown.
   at Jellyfin.Drawing.Skia.SkiaHelper.EnsureSuccess(SKCodecResult result) in C:\Programming\jellyfin\Jellyfin.Drawing.Skia\SkiaHelper.cs:line 21
   at Jellyfin.Drawing.Skia.SkiaEncoder.GetImageSize(String path) in C:\Programming\jellyfin\Jellyfin.Drawing.Skia\SkiaEncoder.cs:line 184
   at Emby.Drawing.ImageProcessor.GetImageDimensions(String path) in C:\Programming\jellyfin\Emby.Drawing\ImageProcessor.cs:line 316
   at Emby.Drawing.ImageProcessor.GetImageDimensions(BaseItem item, ItemImageInfo info) in C:\Programming\jellyfin\Emby.Drawing\ImageProcessor.cs:line 307
   at Emby.Server.Implementations.Library.LibraryManager.UpdateImagesAsync(BaseItem item, Boolean forceUpdate) in C:\Programming\jellyfin\Emby.Server.Implementations\Library\LibraryManager.cs:line 1906

The contents of poster.xml is:

<?xml version="1.0" encoding="UTF-8"?>
<Error><Code>AccessDenied</Code><Message>Access Denied</Message><RequestId>CAC0C74554096849</RequestId><HostId>OyoYC1pxFTjsgsAxxQS1ofhXCLHxSTwWN//TlTwP6IMaD/C8v3Rm5/ihwSTCgDa1V9pQO0iVrag=</HostId></Error>

It downloaded an invalid season poster. That response is the default tvdb response for invalid images. For example going to https://www.thetvdb.com/banners/seasons/abc123-1.jpg returns the same thing.

The root cause might be related to how TvdbSeasonImageProvider works because maybe it shouldn't be telling jellyfin to get an image for that url. Anyway I think this status code check should still be added.

The result makes it print this nice warning instead of an error:

[2020-09-27 21:45:51.978 -07:00] [WRN] [85] Emby.Server.Implementations.Library.LibraryManager: Cannot fetch image from "https://www.thetvdb.com/banners/seasons/abc123-1.jpg"

Changes

  • Check that the status code is 200 OK before saving images

Issues
None that I saw


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/jellyfin/jellyfin/pull/4225 **Author:** [@Spacetech](https://github.com/Spacetech) **Created:** 9/28/2020 **Status:** ✅ Merged **Merged:** 10/5/2020 **Merged by:** [@Bond-009](https://github.com/Bond-009) **Base:** `master` ← **Head:** `save_image_check` --- ### 📝 Commits (4) - [`3ca9b13`](https://github.com/jellyfin/jellyfin/commit/3ca9b13f99a863fee2a2b335555311cc1e9665aa) Check response status code before saving images - [`722ec43`](https://github.com/jellyfin/jellyfin/commit/722ec43e258eb9e6af4c0cd09f68a4a969e50cc8) remove status code from exception message - [`e9911b7`](https://github.com/jellyfin/jellyfin/commit/e9911b70ddfd9a9ee1f9b89579f5dbec154129a4) Use EnsureSuccessStatusCode - [`25d8d85`](https://github.com/jellyfin/jellyfin/commit/25d8d85740f984f051cebc5db53466c17688c370) Back to HttpException ### 📊 Changes **1 file changed** (+8 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `MediaBrowser.Providers/Manager/ProviderManager.cs` (+8 -0) </details> ### 📄 Description At some point jellyfin downloaded a "poster" that is actually an xml file and ran into trouble getting the image dimensions: ``` [2020-09-27 14:40:58.006 -07:00] [ERR] [47] Emby.Server.Implementations.Library.LibraryManager: Cannot get image dimensions for "C:\Users\Gary\AppData\Local\jellyfin\metadata\library\ba\ba96d5eae180f07a89aee79d69c228f0\poster.xml" Non-success codec result: Unimplemented Jellyfin.Drawing.Skia.SkiaCodecException: Exception of type 'Jellyfin.Drawing.Skia.SkiaCodecException' was thrown. at Jellyfin.Drawing.Skia.SkiaHelper.EnsureSuccess(SKCodecResult result) in C:\Programming\jellyfin\Jellyfin.Drawing.Skia\SkiaHelper.cs:line 21 at Jellyfin.Drawing.Skia.SkiaEncoder.GetImageSize(String path) in C:\Programming\jellyfin\Jellyfin.Drawing.Skia\SkiaEncoder.cs:line 184 at Emby.Drawing.ImageProcessor.GetImageDimensions(String path) in C:\Programming\jellyfin\Emby.Drawing\ImageProcessor.cs:line 316 at Emby.Drawing.ImageProcessor.GetImageDimensions(BaseItem item, ItemImageInfo info) in C:\Programming\jellyfin\Emby.Drawing\ImageProcessor.cs:line 307 at Emby.Server.Implementations.Library.LibraryManager.UpdateImagesAsync(BaseItem item, Boolean forceUpdate) in C:\Programming\jellyfin\Emby.Server.Implementations\Library\LibraryManager.cs:line 1906 ``` The contents of `poster.xml` is: ``` <?xml version="1.0" encoding="UTF-8"?> <Error><Code>AccessDenied</Code><Message>Access Denied</Message><RequestId>CAC0C74554096849</RequestId><HostId>OyoYC1pxFTjsgsAxxQS1ofhXCLHxSTwWN//TlTwP6IMaD/C8v3Rm5/ihwSTCgDa1V9pQO0iVrag=</HostId></Error> ``` It downloaded an invalid season poster. That response is the default tvdb response for invalid images. For example going to https://www.thetvdb.com/banners/seasons/abc123-1.jpg returns the same thing. The root cause might be related to how `TvdbSeasonImageProvider` works because maybe it shouldn't be telling jellyfin to get an image for that url. Anyway I think this status code check should still be added. The result makes it print this nice warning instead of an error: ``` [2020-09-27 21:45:51.978 -07:00] [WRN] [85] Emby.Server.Implementations.Library.LibraryManager: Cannot fetch image from "https://www.thetvdb.com/banners/seasons/abc123-1.jpg" ``` **Changes** - Check that the status code is 200 OK before saving images **Issues** None that I saw --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
OVERLORD added the pull-request label 2026-02-07 06:11:32 +03:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/jellyfin#9958