mirror of
https://git.srhtnin.garden/sarah/SaraView.git
synced 2026-10-15 02:43:17 +02:00
Fixed download sizes and directory highlighting
Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
1 parent
843ad1986e
commit
d4c018a402
8 files changed
+113
-37
No files matched your search
+3
-6
@@ -800,12 +800,9 @@ def GetDownloadEndpoint(Root: str, Path: str, CurrentUser: dict = Depends(GetCur
|
||||
EncodedName = quote(DownloadName)
|
||||
Headers = {"Content-Disposition": f"attachment; filename*=UTF-8''{EncodedName}"}
|
||||
|
||||
def IterateDownload():
|
||||
with EntryPath.open("rb") as SourceFile:
|
||||
while Chunk := SourceFile.read(1024 * 1024):
|
||||
yield Chunk
|
||||
|
||||
return StreamingResponse(IterateDownload(), media_type=MimeType, headers=Headers)
|
||||
# FileResponse sends Content-Length, so browsers can show the size and
|
||||
# time left (a plain stream showed them as unknown).
|
||||
return FileResponse(EntryPath, media_type=MimeType, headers=Headers)
|
||||
|
||||
|
||||
@Application.get("/api/book")
|
||||
|
||||
Reference in new issue
Block a user