fix(files): update Content-Length handling for tool and remote files (#9649)

This commit is contained in:
-LAN- 2024-10-22 17:24:42 +08:00 committed by GitHub
commit d6e8290a1c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 4 additions and 4 deletions

View file

@ -42,10 +42,10 @@ class ToolFilePreviewApi(Resource):
stream,
mimetype=tool_file.mimetype,
direct_passthrough=True,
headers={
"Content-Length": str(tool_file.size),
},
headers={},
)
if tool_file.size > 0:
response.headers["Content-Length"] = str(tool_file.size)
if args["as_attachment"]:
response.headers["Content-Disposition"] = f"attachment; filename={tool_file.name}"