From 47f60527e264c6842fb587eec51aeec3949a492c Mon Sep 17 00:00:00 2001 From: LincolnBurrows2017 Date: Fri, 13 Mar 2026 10:40:57 +0000 Subject: [PATCH] fix: Content-Disposition header to comply with RFC2183 Changed Content-Disposition header from 'filename=...' to 'attachment; filename=...' to comply with RFC 2183. This fixes issue #8914 where third-party downloading libraries fail to parse the filename correctly due to incorrect header format. Fixes: https://github.com/Comfy-Org/ComfyUI/issues/8914 --- server.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/server.py b/server.py index 76904ebc9..8e738f0f5 100644 --- a/server.py +++ b/server.py @@ -523,7 +523,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' @@ -543,7 +543,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: @@ -560,7 +560,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: # Get content type from mimetype, defaulting to 'application/octet-stream' content_type = mimetypes.guess_type(filename)[0] or 'application/octet-stream' @@ -572,7 +572,7 @@ class PromptServer(): return web.FileResponse( file, headers={ - "Content-Disposition": f"filename=\"{filename}\"", + "Content-Disposition": f"attachment; filename=\"{filename}\"", "Content-Type": content_type } )