From dfadf4ddec07a3979e6d8493d6e2f48f95c12534 Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 20 Nov 2025 00:40:19 +0000 Subject: [PATCH] Fix file download issue - add attachment disposition type to Content-Disposition headers Files were downloading with filename "view" instead of the actual filename because the Content-Disposition header was missing the disposition type (attachment/inline). Changed from `filename="..."` to `attachment; filename="..."` in all 4 locations in the /view endpoint to ensure proper filename handling by browsers. This fixes downloads for videos, audio, and other file types served through the /view endpoint. --- server.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/server.py b/server.py index c9ffcaa0d..974b85949 100644 --- a/server.py +++ b/server.py @@ -574,7 +574,7 @@ class PromptServer(): buffer.seek(0) return web.Response(body=buffer.read(), content_type=f'image/{image_format}', - headers={"Content-Disposition": f"filename=\"{filename}\""}) + headers={"Content-Disposition": f"attachment; filename=\"{filename}\""}) if 'channel' not in request.rel_url.query: channel = 'rgba' @@ -594,7 +594,7 @@ class PromptServer(): buffer.seek(0) return web.Response(body=buffer.read(), content_type='image/png', - headers={"Content-Disposition": f"filename=\"{filename}\""}) + headers={"Content-Disposition": f"attachment; filename=\"{filename}\""}) elif channel == 'a': with Image.open(file) as img: @@ -611,7 +611,7 @@ class PromptServer(): alpha_buffer.seek(0) return web.Response(body=alpha_buffer.read(), content_type='image/png', - headers={"Content-Disposition": f"filename=\"{filename}\""}) + headers={"Content-Disposition": f"attachment; filename=\"{filename}\""}) else: # Use the content type from asset resolution if available, # otherwise guess from the filename.