Mache große IMAP-Fächer, die Paperless-Suche und die interne Markdown-Notiz über die gemeinsamen Schnittstellen benutzbar.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
c3a07cee64
commit
7e39fbb2bd
29 files changed
+6053
-320
No files matched your search
+10
-2
@@ -4,6 +4,14 @@ from __future__ import annotations
|
||||
|
||||
from dataclasses import dataclass
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
def discard_stored(item) -> None:
|
||||
discard = getattr(item, "discard", None)
|
||||
if callable(discard):
|
||||
discard()
|
||||
return
|
||||
Path(item).unlink(missing_ok=True)
|
||||
from uuid import UUID
|
||||
|
||||
from fastapi import Depends, Request
|
||||
@@ -35,11 +43,11 @@ def get_conn(request: Request):
|
||||
yield conn
|
||||
conn.commit()
|
||||
for path in getattr(request.state, "delete_after_commit", []):
|
||||
Path(path).unlink(missing_ok=True)
|
||||
discard_stored(path)
|
||||
except Exception:
|
||||
conn.rollback()
|
||||
for path in getattr(request.state, "cleanup_files", []):
|
||||
Path(path).unlink(missing_ok=True)
|
||||
discard_stored(path)
|
||||
raise
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user