Skip to content

Commit

Permalink
Fix wrong filename downloads
Browse files Browse the repository at this point in the history
  • Loading branch information
Willy-JL committed Mar 25, 2024
1 parent 44d3e38 commit 822a625
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions indexer/src/directories.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,7 @@ async def latest_request(directory, channel, target, file_type):
return JSONResponse(str(e), status_code=404)


@router.get(
"/{directory}/{channel}/{file_name}",
response_class=FileResponse,
status_code=200,
)
@router.get("/{directory}/{channel}/{file_name}")
async def file_request(directory, channel, file_name):
"""
A method for retrieving a file from the repository
Expand All @@ -77,7 +73,11 @@ async def file_request(directory, channel, file_name):
if len(index.index["channels"]) == 0:
return JSONResponse("No channels found!", status_code=404)
try:
return index.get_file_path(channel, file_name)
return FileResponse(
index.get_file_path(channel, file_name),
media_type="application/octet-stream",
status_code=200,
)
except Exception as e:
return JSONResponse(str(e), status_code=404)

Expand Down

0 comments on commit 822a625

Please sign in to comment.