Merge pull request #496 from vastsa/fix/pr494-security-patches

fix: harden share expiry, download token, quota SQL, and CORS
This commit is contained in:
Lan authored and GitHub committed 2026-07-23 19:41:40 +08:00
commit ae7702603a
7 files changed
+223 -17

No files matched your search

+10 -3
View File
@@ -25,6 +25,7 @@ from core.settings import data_root, settings
from apps.base.models import FileCodes, UploadChunk
from core.utils import get_file_url, sanitize_filename
from fastapi.responses import FileResponse, StreamingResponse
from starlette.background import BackgroundTask
class FileStorageInterface:
@@ -395,7 +396,9 @@ class S3FileStorage(FileStorageInterface):
return StreamingResponse(
stream_generator(),
media_type="application/octet-stream",
headers=headers
headers=headers,
# 兜底关闭会话:客户端中断时与 generator finally 双保险
background=BackgroundTask(session.close),
)
except HTTPException:
raise
@@ -733,7 +736,9 @@ class OneDriveFileStorage(FileStorageInterface):
return StreamingResponse(
stream_generator(),
media_type="application/octet-stream",
headers=headers
headers=headers,
# 兜底关闭会话:客户端中断时与 generator finally 双保险
background=BackgroundTask(session.close),
)
except HTTPException:
raise
@@ -1209,7 +1214,9 @@ class WebDAVFileStorage(FileStorageInterface):
return StreamingResponse(
stream_generator(),
media_type="application/octet-stream",
headers=headers
headers=headers,
# 兜底关闭会话:客户端中断时与 generator finally 双保险
background=BackgroundTask(session.close),
)
except aiohttp.ClientError as e:
raise HTTPException(