mirror of
https://git.victorphan.net/basketballcantho/ten-project.git
synced 2026-08-05 13:13:11 +07:00
các chức năng thumbnail, scroll continuos đã xong
This commit is contained in:
@@ -14,7 +14,7 @@ from ..schemas import PDFOut, PDFUploadResult
|
||||
router = APIRouter(prefix="/pdfs", tags=["pdfs"])
|
||||
|
||||
UPLOAD_DIR = Path(os.getenv("UPLOAD_DIR", "/uploads"))
|
||||
MAX_FILE_SIZE = 50 * 1024 * 1024 # 50 MB
|
||||
MAX_FILE_SIZE = 500 * 1024 * 1024 # 500 MB
|
||||
|
||||
|
||||
def _user_dir(user_id: int) -> Path:
|
||||
@@ -71,7 +71,7 @@ async def upload_pdfs(
|
||||
# ── Size guard ────────────────────────────────────────────────────────
|
||||
body = header + await file.read()
|
||||
if len(body) > MAX_FILE_SIZE:
|
||||
results.append(PDFUploadResult(filename=file.filename or "", success=False, error="File exceeds 50 MB limit."))
|
||||
results.append(PDFUploadResult(filename=file.filename or "", success=False, error="File exceeds 500 MB limit."))
|
||||
continue
|
||||
|
||||
# ── Save to disk with UUID filename (prevents path traversal) ─────────
|
||||
|
||||
Reference in New Issue
Block a user