Mache große IMAP-Fächer, die Paperless-Suche und die interne Markdown-Notiz über die gemeinsamen Schnittstellen benutzbar.
Deploy Development / deploy (push) Successful in 41s
Test Suite / pytest-backend (push) Failing after 2m55s
Test Suite / smoke-dev (push) Successful in 0s
Test Suite / frontend-build (push) Successful in 23s

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
LarsandCursor committed 2026-10-20 07:34:14 +02:00
1 parent c3a07cee64
commit 7e39fbb2bd
29 files changed
+6053 -320

No files matched your search

+49 -1
View File
@@ -208,6 +208,47 @@ def instance_for_write(conn, media_root: str) -> dict:
).fetchone()
class StoredHandle:
"""Rollback and delete go through the adapter that owns the bytes."""
def __init__(self, adapter: StoragePort, object_key: str):
self._adapter = adapter
self._key = object_key
def discard(self) -> None:
self._adapter.delete(self._key)
_FACTORIES: dict[str, callable] = {}
def _local_factory(row: dict) -> StoragePort:
return LocalAdapter(row["root_path"])
_FACTORIES["local"] = _local_factory
def adapter_for(row: dict) -> StoragePort:
factory = _FACTORIES.get(row["kind"])
if factory is None or not row.get("root_path") and row["kind"] == "local":
raise storage_unavailable()
return factory(row)
def removal_for(conn, instance_id, generation: str | None, object_key: str, media_root: str) -> StoredHandle:
row = None
if instance_id is not None:
row = conn.execute(
"SELECT id, kind, generation, root_path FROM storage_instances WHERE id = %s",
(instance_id,),
).fetchone()
if row is None:
root = resolve_root(conn, instance_id, generation, media_root)
return StoredHandle(LocalAdapter(root), object_key)
return StoredHandle(adapter_for(row), object_key)
def resolve_root(conn, instance_id, generation: str | None, media_root: str) -> str:
if instance_id is not None:
row = conn.execute(
@@ -236,7 +277,14 @@ def read_clear_bytes(
expected_sha256: str | None,
) -> bytes:
require_cleartext(protection_profile)
data = LocalAdapter(resolve_root(conn, instance_id, generation, media_root)).open(object_key)
row = None
if instance_id is not None:
row = conn.execute(
"SELECT id, kind, generation, root_path FROM storage_instances WHERE id = %s",
(instance_id,),
).fetchone()
adapter = adapter_for(row) if row is not None else LocalAdapter(resolve_root(conn, instance_id, generation, media_root))
data = adapter.open(object_key)
if expected_sha256 and sha256(data) != expected_sha256:
raise Problem(
422,