Skip to content

Add 'overwrite' option to ImapHook.download_mail_attachments#65878

Closed
shashbha14 wants to merge 3 commits into
apache:mainfrom
shashbha14:fix/imap-overwrite-65870-clean
Closed

Add 'overwrite' option to ImapHook.download_mail_attachments#65878
shashbha14 wants to merge 3 commits into
apache:mainfrom
shashbha14:fix/imap-overwrite-65870-clean

Conversation

@shashbha14

Copy link
Copy Markdown
Contributor

Resolves #65870
At present, the method 'ImapHook.download_mail_attachments' silently overwrites existing files in the event that attachments are re-downloaded using the same filename.
This PR introduces an 'overwrite: bool = True' optional parameter to 'download_mail_attachments' (and its internal methods 'create_files' and '_create_file'). If 'False', a suffix is added to the filename ('file.csv' → 'file_1.csv') rather than overwriting.
The default is 'True' for backwards compatibility.
I utilized Claude (claude.ai) as my AI helper on parts of this implementation.

@shashbha14
shashbha14 marked this pull request as ready for review April 28, 2026 15:37
@potiuk potiuk added the ready for maintainer review Set after triaging when all criteria pass. label May 5, 2026

@SameerMesiah97 SameerMesiah97 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good.

@vincbeck

vincbeck commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

Fixed in #68838

@vincbeck vincbeck closed this Jul 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:providers provider:imap ready for maintainer review Set after triaging when all criteria pass.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

IMAP hook silently overwrites attachments with identical filenames

4 participants