feat: dateiaustausch im backend

Dateien als Clip-Art "file": gestreamter Upload mit Größengrenze, Kontingent
pro Benutzer und Mindestreserve an freiem Speicher. Download immer als
Anhang mit sandbox-CSP, Vorschau nur für geprüfte JPEG/PNG/GIF/WebP.
Ablauf nach 1/7/30 Tagen oder nie; der Aufräumjob löscht abgelaufene und
verwaiste Dateien.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
dbildhauerandClaude Opus 5.5 committed 2026-10-25 14:01:10 +01:00
1 parent ae334d2248
commit 52a8fd019f
12 files changed
+1027 -11

No files matched your search

+14 -2
View File
@@ -90,13 +90,25 @@ class BodySizeLimitMiddleware:
When a stream exceeds the limit, the 413 is sent here and the app sees a disconnect.
"""
def __init__(self, app: ASGIApp, max_bytes: int, path_prefix: str = "/api/") -> None:
def __init__(
self,
app: ASGIApp,
max_bytes: int,
path_prefix: str = "/api/",
exempt: frozenset[tuple[str, str]] = frozenset(),
) -> None:
self.app = app
self.max_bytes = max_bytes
self.path_prefix = path_prefix
# (method, path) pairs that enforce their own, larger limit (file uploads)
self.exempt = exempt
async def __call__(self, scope: Scope, receive: Receive, send: Send) -> None:
if scope["type"] != "http" or not scope["path"].startswith(self.path_prefix):
if (
scope["type"] != "http"
or not scope["path"].startswith(self.path_prefix)
or (scope["method"], scope["path"]) in self.exempt
):
await self.app(scope, receive, send)
return