get_fernet() only checked for an empty ENCRYPTION_KEY. A non-empty but
malformed key (not 32 url-safe base64 bytes) let Fernet() raise a raw
ValueError that crashed sync_account. Wrap the constructor and re-raise
as EncryptionError with a clear message.
Paperclip-BIT-33940
The finally block in sync_account and retry_single_message only caught
imaplib.IMAP4.error from imap.logout(). When the underlying socket had
already timed out, logout() raises OSError('cannot read from timed out
object') which escaped the handler and crashed the sync run.
Add OSError to the except tuple so cleanup completes cleanly.
Paperclip-BIT-33892
TimeoutError (OSError subclass) escaped the imaplib.IMAP4.error handler
in sync_account, killing the entire sync run on a single slow fetch.
Catch OSError alongside IMAP4.error to skip the timed-out message and
continue scanning.
Paperclip-BIT-33891
Some WebDAV servers (Nextcloud, ownCloud, Apache mod_dav with infinite
depth disabled) reject Depth:infinity PROPFIND with HTTP 500/403/501.
list_files now retries with a recursive Depth:1 traversal of child
collections, preserving full relative paths for year-folder filtering
and dedup keys.
BIT-33518
Paperclip-Ref: BIT-33518
WebDAV sync rejected valid files like 1784074260.pdf when the PDF magic
bytes were not at offset 0 (whitespace/BOM) or when a mobile scanner stored
JPEG bytes under a .pdf name. Scan the first 1KB for %PDF-, allow image
fallback for .pdf, and include validation detail in API errors.
Co-authored-by: Cursor <[email protected]>
Add default vs custom IMAP folder selection with live folder fetch in admin UI,
Alembic migration, sync filtering, and API endpoints for mailbox discovery.
Co-authored-by: Cursor <[email protected]>
Files under Faturas/2025/ or /2026/ are eligible even when Nextcloud
reports creationdate 1970. Add --requeue-folder-years to reset wrongly skipped records.
Add webdav_include_years account setting, skip files outside allowed year folders during sync, and a setup tool to mark older paths as already forwarded.
Add optional API upload alongside SMTP, Nextcloud/WebDAV as a document source with the same dedup/retry flow as IMAP, stricter invoice file checks for images, and admin UI for source and delivery modes.
Re-sending the original MIME kept Cc/Bcc (e.g. faturas@) so copies
returned to the monitored inbox. Drop extra recipient headers and
send SMTP RCPT only to the BizDocs destination.
Re-send the received RFC822 message with normal Fwd headers (To, From,
Subject). The previous code wrapped the message in message/rfc822 with
filename original-email.eml, which the relay rejected.
The outbound SMTP relay rejects message/rfc822 attachments named .eml.
Send the matched invoice files directly to BizDocs, which aligns with
the allowed relay extensions and the product filter rules.
Add manual sync buttons with batch limit, nginx timeouts for long syncs,
message retry endpoint, and fix worker to skip disabled accounts and
refresh schedules from the database every 2 minutes.