vaefremov95 opened a new issue, #65870: URL: https://github.com/apache/airflow/issues/65870
### Under which category would you file this issue? Providers ### Apache Airflow version 3.2.1 ### What happened and how to reproduce it? **Problem** When using `imap_hook.download_mail_attachments`, attachments with identical filenames are saved to disk using the same name, which leads to silent overwriting of previously downloaded files. This results in data loss without any warning, and there is currently no option to control this behavior. **How to reproduce** 1. Receive multiple emails with attachments sharing the same filename (e.g. report.xlsx) 2. Call imap_hook.download_mail_attachments 3. Inspect the output directory 4. Observe that only one file is present, as earlier files were overwritten ### What you think should happen instead? There should be a configurable way to control how filename collisions are handled when saving attachments, for example: - either allow overwriting existing files - or preserve all files by automatically renaming them. The current behavior should not be hardcoded without user control. **Possible improvement** Introduce a configurable parameter (e.g. overwrite_file or similar) that controls collision handling behavior: - overwrite_file=True → overwrite existing files (current behavior) - overwrite_file=False → preserve all files This would make the behavior explicit and safe for different use cases. ### Operating System _No response_ ### Deployment Official Apache Airflow Helm Chart ### Apache Airflow Provider(s) imap ### Versions of Apache Airflow Providers apache-airflow-providers-imap==3.11.0 ### Official Helm Chart version Not Applicable ### Kubernetes Version _No response_ ### Helm Chart configuration _No response_ ### Docker Image customizations _No response_ ### Anything else? A previous implementation attempt and discussion can be found here: https://github.com/apache/airflow/pull/62321 ### Are you willing to submit PR? - [ ] Yes I am willing to submit a PR! ### Code of Conduct - [x] I agree to follow this project's [Code of Conduct](https://github.com/apache/airflow/blob/main/CODE_OF_CONDUCT.md) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
