Korrigiere IMAP-Ordner, MIME-Ansicht und die gemeinsamen Leser, damit große Postfächer, Notizen und verspätete Quellenantworten zuverlässig bleiben.
Deploy Development / deploy (push) Successful in 39s
Test Suite / pytest-backend (push) Successful in 2m29s
Test Suite / smoke-dev (push) Successful in 0s
Test Suite / frontend-build (push) Successful in 20s

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
LarsandCursor committed 2026-10-20 08:47:24 +02:00
1 parent 34c4084a7c
commit c29bd29f34
29 files changed
+2562 -410

No files matched your search

+32 -2
View File
@@ -695,9 +695,18 @@ def _emit_one(node, prefix, add, entries, loaded, notice_for, generated: str) ->
links = [("EML-Original", eml)]
try:
parsed = payload.parsed if isinstance(payload, MailPayload) else parse_mail(raw)
reading = _mail_reading_html(parsed)
if reading is not None:
reading_path = add(prefix + ["lesefassung.html"], reading)
links.append(("Formatierte Lesefassung", reading_path))
else:
notice = "\n".join(part for part in [notice, "Eine formatierte Lesefassung liegt für diese Nachricht nicht vor. Die vereinfachte Textfassung steht in der Übersicht."] if part)
for attachment in parsed.attachments:
label = attachment.display_name or attachment.filename
path = add(prefix + ["anlagen", attachment.filename], attachment.data)
links.append((attachment.filename, path))
links.append((label, path))
if parsed.notices:
notice = "\n".join(part for part in [notice, *parsed.notices] if part)
except Exception:
links.append(("Hinweis", eml))
entries.append(_entry(node, eml, links, notice or None))
@@ -1223,6 +1232,21 @@ def _note_markdown(node: ExportNode, body: str, generated: str) -> str:
return "\n".join(lines)
def _mail_reading_html(parsed) -> bytes | None:
if not getattr(parsed, "html", ""):
return None
page = (
"<!DOCTYPE html><html lang=\"de\"><head><meta charset=\"utf-8\">"
"<meta http-equiv=\"Content-Security-Policy\" content=\"default-src 'none'; img-src data:; style-src 'none'; script-src 'none'\">"
"<title>Lesefassung</title></head><body>"
f"{parsed.html}"
"<p>Vereinfachte Textfassung und das unveränderte EML-Original stehen daneben. "
"Die Ansicht ist nicht pixelgleich zur Postfachdarstellung.</p>"
"</body></html>"
)
return page.encode("utf-8")
def _mail_markdown(node, mail: MailPayload, text_path: str, eml_path: str, attachments, notice: str, generated: str) -> str:
parsed = mail.parsed
lines = [f"# {node.title}", "", "Lesefassung. Das unveränderte Original ist die EML-Datei.", ""]
@@ -1234,7 +1258,13 @@ def _mail_markdown(node, mail: MailPayload, text_path: str, eml_path: str, attac
if parsed.copy:
lines.append(f"- Kopie: {parsed.copy}")
lines.append(f"- [EML-Original]({_href(_relative(text_path, eml_path))})")
lines.extend(["", parsed.text or "Der Text steht im EML-Original.", ""])
lines.extend([
"",
"Vereinfachte Textfassung. Sie ist nicht die formatierte Ansicht und nicht das EML-Original.",
"",
parsed.text or "Der Text steht im EML-Original.",
"",
])
if attachments:
lines.append("## Anlagen")
lines.append("")