Steuere das Herunterladen von Originalen je Rolle, benenne Dateien richtig und zeige HTML-Mails gesichert im Sandbox-Rahmen.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
0a5daf6713
commit
075525ee17
26 files changed
+494
-71
No files matched your search
@@ -101,7 +101,7 @@ from app.auth.security import (
|
||||
verify_password,
|
||||
verify_unknown_account,
|
||||
)
|
||||
from app.core.errors import Problem, forbidden, not_found, too_many, unprocessable
|
||||
from app.core.errors import DOWNLOAD_REFUSED, Problem, forbidden, not_found, too_many, unprocessable
|
||||
from app.core.timeutil import dump_date, dump_dt, utcnow
|
||||
from app.media.port import read_clear_bytes
|
||||
from app.media.storage import content_disposition
|
||||
@@ -932,6 +932,7 @@ def download_file(
|
||||
request: Request,
|
||||
context_kind: str | None = None,
|
||||
context_id: str | None = None,
|
||||
save: bool = False,
|
||||
principal: Principal = Depends(get_principal),
|
||||
conn: Connection = Depends(get_conn),
|
||||
):
|
||||
@@ -942,6 +943,8 @@ def download_file(
|
||||
rights = element_rights(conn, principal.account_id, element, context)
|
||||
if not rights.read:
|
||||
raise not_found()
|
||||
if save and not rights.download:
|
||||
raise forbidden(DOWNLOAD_REFUSED)
|
||||
asset = conn.execute(
|
||||
"""
|
||||
SELECT id, original_filename, content_type, sha256, status,
|
||||
|
||||
Reference in new issue
Block a user