From 3c25f5dc0f52788d41b9a44a9e03b845df06b3e8 Mon Sep 17 00:00:00 2001 From: pythongosssss <125205205+pythongosssss@users.noreply.github.com> Date: Wed, 22 Mar 2023 17:32:01 +0000 Subject: [PATCH] Add content disposition header so images have name --- server.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/server.py b/server.py index 6615a39e..73429acc 100644 --- a/server.py +++ b/server.py @@ -129,12 +129,12 @@ class PromptServer(): return web.Response(status=403) output_dir = full_output_dir - file = request.rel_url.query["filename"] - file = os.path.basename(file) - file = os.path.join(output_dir, file) + filename = request.rel_url.query["filename"] + filename = os.path.basename(filename) + file = os.path.join(output_dir, filename) if os.path.isfile(file): - return web.FileResponse(file) + return web.FileResponse(file, headers={"Content-Disposition": f"filename=\"{filename}\""}) return web.Response(status=404)