🐛 Fixed some tests

This commit is contained in:
Mawoka
2023-06-17 20:45:04 +02:00
parent 1459c6f786
commit 7227cd82e1
5 changed files with 110 additions and 245 deletions
+2 -5
View File
@@ -52,15 +52,12 @@ async def download_file(file_name: str):
else:
return RedirectResponse(url=await storage.get_url(file_name, 300), headers=headers_from_storage_item(item))
try:
download = await storage.download(file_name)
download = storage.download(file_name)
except DownloadingFailedError:
raise HTTPException(status_code=404, detail="File not found")
if download is None:
raise HTTPException(status_code=404, detail="File not found")
def iter_file():
yield from download
media_type = "image/*"
if item is not None:
media_type = item.mime_type
@@ -69,7 +66,7 @@ async def download_file(file_name: str):
headers = {**headers, **headers_from_storage_item(item)}
return StreamingResponse(
iter_file(),
download,
media_type=media_type,
headers=headers,
)