From 8179b4b1748e1b582f2452c395a3acb840b9dc54 Mon Sep 17 00:00:00 2001 From: zhaog100 Date: Sun, 22 Mar 2026 04:00:23 +0800 Subject: [PATCH] fix: Content-Disposition header to match RFC2183 Add disposition-type 'inline' to Content-Disposition headers in view_image function. Previously the header was set as 'filename="name.ext"' which doesn't match RFC2183 format. Now correctly formatted as 'inline; filename="name.ext"'. Closes #8914 --- server.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/server.py b/server.py index 173a28376..e45401b27 100644 --- a/server.py +++ b/server.py @@ -555,7 +555,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"inline; filename=\"{filename}\""}) if 'channel' not in request.rel_url.query: channel = 'rgba' @@ -575,7 +575,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"inline; filename=\"{filename}\""}) elif channel == 'a': with Image.open(file) as img: @@ -592,7 +592,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"inline; filename=\"{filename}\""}) else: # Use the content type from asset resolution if available, # otherwise guess from the filename. @@ -609,7 +609,7 @@ class PromptServer(): return web.FileResponse( file, headers={ - "Content-Disposition": f"filename=\"{filename}\"", + "Content-Disposition": f"inline; filename=\"{filename}\"", "Content-Type": content_type } )