🎨 black

This commit is contained in:
Mawoka
2022-04-09 11:06:36 +02:00
parent fd0b51d7e3
commit 6d5ba5ce74
18 changed files with 403 additions and 159 deletions
+6 -3
View File
@@ -12,7 +12,7 @@ router = APIRouter()
file_regex = r"^[a-z0-9]{8}-[a-z0-9-]{27}--[a-z0-9-]{36}$"
@router.get('/download/{file_name}')
@router.get("/download/{file_name}")
async def download_file(file_name: str):
if not re.match(file_regex, file_name):
raise HTTPException(status_code=400, detail="Invalid file name")
@@ -24,5 +24,8 @@ async def download_file(file_name: str):
def iter_file():
yield from download
return StreamingResponse(iter_file(), media_type='image/*',
headers={"Cache-Control": "public, immutable, max-age=31536000"})
return StreamingResponse(
iter_file(),
media_type="image/*",
headers={"Cache-Control": "public, immutable, max-age=31536000"},
)