Abdeltoto opened a new pull request, #67933: URL: https://github.com/apache/airflow/pull/67933
Closes #65870 This PR adds an `overwrite_file` option to `ImapHook.download_mail_attachments` so callers can choose whether duplicate attachment filenames overwrite existing files or are preserved with incremental suffixes. By default, `overwrite_file=True` keeps the current behavior. With `overwrite_file=False`, existing files are preserved using suffixes such as `report_1.xlsx`. Tests cover: - default overwrite behavior, including verifying the file content is replaced - preserving duplicate filenames when `overwrite_file=False` - filenames with a normal extension, no extension, and multiple extensions Tested locally: - `python -m py_compile providers/imap/src/airflow/providers/imap/hooks/imap.py providers/imap/tests/unit/imap/hooks/test_imap.py` - `git diff --check` I could not run the targeted pytest file locally from this sparse checkout because `airflow` is not installed in this environment. --- ##### Was generative AI tooling used to co-author this PR? - [x] Yes (please specify the tool below) Generated-by: GPT-5.5 following the Airflow pull request guidelines. -- 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]
