Skip to content

Commit

Permalink
Remove path from location for download file name
Browse files Browse the repository at this point in the history
  • Loading branch information
agners committed Jan 22, 2025
1 parent e295348 commit 997b281
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions supervisor/api/backups.py
Original file line number Diff line number Diff line change
Expand Up @@ -464,9 +464,12 @@ async def download(self, request: web.Request):
response = web.FileResponse(filename)
response.content_type = CONTENT_TYPE_TAR

if filename == f"{backup.slug}.tar":
filename = f"{RE_SLUGIFY_NAME.sub('_', backup.name)}.tar"
response.headers[CONTENT_DISPOSITION] = f"attachment; filename={filename}"
download_filename = filename.name
if download_filename == f"{backup.slug}.tar":
download_filename = f"{RE_SLUGIFY_NAME.sub('_', backup.name)}.tar"
response.headers[CONTENT_DISPOSITION] = (
f"attachment; filename={download_filename}"
)
return response

@api_process
Expand Down

0 comments on commit 997b281

Please sign in to comment.