fix(cli,email): quoted-relative file-drop paths + Date header on tool email path#19646
Merged
Conversation
Adds RFC 5322 Date header to the _send_email tool path in tools/send_message_tool.py. Issue #15160 noted that both gateway/platforms/email.py and tools/send_message_tool.py construct MIMEMultipart/MIMEText messages without setting a Date header. RFC 5322 requires the Date header; mail filters reject messages that lack it. PR #15207 fixed the gateway/platforms/email.py path but did not cover tools/send_message_tool._send_email, which is used by the send_message tool for cross-channel messaging. This change adds msg["Date"] = formatdate(localtime=True) to _send_email, mirroring the fix applied to the gateway email adapter. Closes #15160
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Salvage of #15235 by @ms-alan onto current main.
Summary
Two related fixes in one PR:
1.
fix(cli): detect quoted relative paths in_detect_file_drop— Thestarts_like_pathprefilter in_detect_file_drop()previously only recognized unquoted./,../,/,~prefixes and quoted-absolute prefixes. Quoted relative-path prefixes ("./,"../,'./,'../) were rejected even though the underlying path resolution supports them. Inputs like"./rel image.png" describe thiswere treated as plain text instead of parsed as an image attachment. Closes #15197.2.
fix(email): add RFC 5322 Date header tosend_message_tool._send_email— PR #15207 added the Date header togateway/platforms/email.pybut missed the parallel path intools/send_message_tool._send_email. Mail filters reject messages without a Date header. Closes #15160.Note on authorship
The original commits were authored as
pander <>with an empty email (a git-config quirk on the contributor's machine). Commits preserved in this salvage, with author set toms-alan <chenb19870707@gmail.com>(the PR opener's public email on GitHub) so they pass the AUTHOR_MAP guard inscripts/release.py.Changes
msg["Date"] = formatdate(localtime=True)(+2/-1)Validation
Manual review; both changes are surgical and mirror fixes already applied elsewhere in the codebase.
Original PR: #15235