Set log download attachment name to crawl_id.log (#1280)

Fixes #1271
Using .log for now due to broader support for opening with default viewers

---------
Co-authored-by: Ilya Kreymer <ikreymer@users.noreply.github.com>
This commit is contained in:
Tessa Walsh 2023-10-13 23:00:37 -04:00 committed by GitHub
parent aa3f1ebf5f
commit 2383b0d616
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -918,7 +918,13 @@ def init_crawls_api(
resp = await storage_ops.sync_stream_wacz_logs(
org, wacz_files, log_levels, contexts
)
return StreamingResponse(resp)
return StreamingResponse(
resp,
media_type="text/jsonl",
headers={
"Content-Disposition": f'attachment; filename="{crawl_id}.log"'
},
)
raise HTTPException(status_code=400, detail="crawl_not_finished")