fix(imap): pass uid:true option to fix UID vs sequence number mismatch#3
Open
benv666 wants to merge 1 commit intojgalea:mainfrom
Open
fix(imap): pass uid:true option to fix UID vs sequence number mismatch#3benv666 wants to merge 1 commit intojgalea:mainfrom
benv666 wants to merge 1 commit intojgalea:mainfrom
Conversation
fetchOne, messageFlagsAdd, messageFlagsRemove, and messageMove all
received the message UID as their range argument but were missing the
{ uid: true } options flag, causing imapflow to treat it as a sequence
number. On any real mailbox the two diverge, breaking read_email,
modify_email, trash_emails, and download_attachment entirely.
Fixes jgalea#2
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.
Fixes #2
NOTE: This PR is claude-generated.
Problem
All IMAP operations that accept a
messageIdtreat it as an IMAP sequence number, but the IDs exposed to callers (viasearch_emails,inbox_summary) are UIDs.On any real mailbox where messages have accumulated, the two diverge causing
read_emailto throwCommand failed,modify_emailto silently no-op, andtrash_emails/download_attachmentto target the wrong message or error.Fix
Pass
{ uid: true }as the options argument to each affected imapflow call:fetchOneinfetchMessagemessageFlagsAdd/messageFlagsRemoveinmodifyLabelsmessageMoveintrashMessagesfetchOneindownloadAttachmentThe change is purely mechanical — 6 lines, no logic changes.
Notes
uid: truein the query object (e.g.{ source: true, uid: true }) tells imapflow to return the UID in the result. The{ uid: true }options argument tells imapflow to treat the range as a UID. These are different parameters — both are correct in their respective positions after this fix.searchMessageshas a related issue mixing sequence numbers and UIDs internally, but works today by coincidence. Worth a follow-up but out of scope here.