Add content disposition header so images have name

This commit is contained in:
pythongosssss 2023-03-22 17:32:01 +00:00
parent f67c00622f
commit 3c25f5dc0f
1 changed files with 4 additions and 4 deletions

View File

@ -129,12 +129,12 @@ class PromptServer():
return web.Response(status=403) return web.Response(status=403)
output_dir = full_output_dir output_dir = full_output_dir
file = request.rel_url.query["filename"] filename = request.rel_url.query["filename"]
file = os.path.basename(file) filename = os.path.basename(filename)
file = os.path.join(output_dir, file) file = os.path.join(output_dir, filename)
if os.path.isfile(file): if os.path.isfile(file):
return web.FileResponse(file) return web.FileResponse(file, headers={"Content-Disposition": f"filename=\"{filename}\""})
return web.Response(status=404) return web.Response(status=404)