3.0.0 #220

Merged
flfeders merged 676 commits from dev into main 2026-09-20 16:10:48 +00:00
Showing only changes of commit 2dd333db1d - Show all commits

View File

@@ -62,6 +62,12 @@ def unique_path(path: Path, overwrite: bool) -> Path:
counter += 1
def quote_imap_string(value: str) -> str:
"""Maskiert einen Text als quotierten IMAP-String."""
escaped = value.replace("\\", "\\\\").replace('"', '\\"')
return f'"{escaped}"'
def message_folder(message: Message, message_id: bytes) -> str:
date_header = decode_mime_header(message.get("Date"))
subject = safe_filename(decode_mime_header(message.get("Subject"), "ohne-betreff"), "ohne-betreff")
@@ -132,7 +138,9 @@ def download_attachments(args: argparse.Namespace) -> DownloadStats:
output_dir = args.output.expanduser().resolve()
output_dir.mkdir(parents=True, exist_ok=True)
status, select_data = client.select(args.mailbox, readonly=True)
# imaplib quotiert Argumente nicht automatisch. Gmail-Postfächer wie
# "[Gmail]/All Mail" würden deshalb wegen des Leerzeichens fehlschlagen.
status, select_data = client.select(quote_imap_string(args.mailbox), readonly=True)
if status != "OK":
details = b" ".join(select_data or []).decode("utf-8", errors="replace")
raise RuntimeError(