From cb83dc2664934bebfe8bfac3fb1d68dc6bc05a4e Mon Sep 17 00:00:00 2001 From: nielsvanvelzen Date: Sun, 25 Aug 2024 02:46:38 -0400 Subject: [PATCH] Backport pull request #12490 from jellyfin/release-10.9.z Set Content-Disposition header to attachment for image endpoints Original-merge: 9645955629595a6ba2668432aeeadc4989c413b2 Merged-by: crobibero Backported-by: Joshua M. Boniface --- Jellyfin.Api/Controllers/ImageController.cs | 2 ++ Jellyfin.Api/Controllers/PluginsController.cs | 2 ++ Jellyfin.Api/Controllers/TrickplayController.cs | 1 + 3 files changed, 5 insertions(+) diff --git a/Jellyfin.Api/Controllers/ImageController.cs b/Jellyfin.Api/Controllers/ImageController.cs index 8e8accab3c..6a169eae3a 100644 --- a/Jellyfin.Api/Controllers/ImageController.cs +++ b/Jellyfin.Api/Controllers/ImageController.cs @@ -2089,6 +2089,8 @@ public class ImageController : BaseJellyfinApiController Response.Headers.Append(HeaderNames.Age, Convert.ToInt64((DateTime.UtcNow - dateImageModified).TotalSeconds).ToString(CultureInfo.InvariantCulture)); Response.Headers.Append(HeaderNames.Vary, HeaderNames.Accept); + Response.Headers.ContentDisposition = "attachment"; + if (disableCaching) { Response.Headers.Append(HeaderNames.CacheControl, "no-cache, no-store, must-revalidate"); diff --git a/Jellyfin.Api/Controllers/PluginsController.cs b/Jellyfin.Api/Controllers/PluginsController.cs index 6abd7a23ee..53b7349e7d 100644 --- a/Jellyfin.Api/Controllers/PluginsController.cs +++ b/Jellyfin.Api/Controllers/PluginsController.cs @@ -233,6 +233,8 @@ public class PluginsController : BaseJellyfinApiController return NotFound(); } + Response.Headers.ContentDisposition = "attachment"; + imagePath = Path.Combine(plugin.Path, plugin.Manifest.ImagePath); return PhysicalFile(imagePath, MimeTypes.GetMimeType(imagePath)); } diff --git a/Jellyfin.Api/Controllers/TrickplayController.cs b/Jellyfin.Api/Controllers/TrickplayController.cs index 0afe053da7..60d49af9e3 100644 --- a/Jellyfin.Api/Controllers/TrickplayController.cs +++ b/Jellyfin.Api/Controllers/TrickplayController.cs @@ -95,6 +95,7 @@ public class TrickplayController : BaseJellyfinApiController var path = _trickplayManager.GetTrickplayTilePath(item, width, index); if (System.IO.File.Exists(path)) { + Response.Headers.ContentDisposition = "attachment"; return PhysicalFile(path, MediaTypeNames.Image.Jpeg); }