Repository navigation
fix(utils): strip plus prefix from user JIDs in ParseJID - #224
Open
danie1net0 wants to merge 1 commit into
Open
danie1net0 wants to merge 1 commit into
danie1net0 wants to merge 1 commit into
Conversation
CreateJID keeps the "+" prefix for IsOnWhatsApp, and ParseJID carried it into JID.User. WhatsApp does not answer queries addressed to "+<number>@s.whatsapp.net", so /user/info and /user/avatar hung until the 75s IQ timeout and returned 500.
Reviewer's GuideParseJID now removes a leading plus from WhatsApp user JIDs, preventing /user/info and /user/avatar queries from timing out while preserving CreateJID and IsOnWhatsApp behavior; tests cover normalized phone inputs, full JIDs, and LIDs. Sequence diagram for normalized user JID queriessequenceDiagram
participant API as User API
participant ParseJID
participant WhatsApp as WhatsApp
API->>ParseJID: ParseJID(number)
ParseJID->>ParseJID: strings.TrimPrefix(user, "+")
ParseJID-->>API: JID without leading +
API->>WhatsApp: /user/info or /user/avatar query
WhatsApp-->>API: Response
File-Level Changes
Possibly linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
fmedeiros95
added a commit
to fmedeiros95/evolution-go
that referenced
this pull request
Nov 4, 2026
Adapt official PR evolution-foundation#224; preserve group and LID identifiers and document the distinction from phone existence checks.
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 #223
Problem
utils.CreateJIDreturns+<number>@s.whatsapp.net. The+is needed forIsOnWhatsApp, bututils.ParseJIDpasses that string totypes.ParseJID, so the+ends up inJID.User. WhatsApp never answers queries addressed to+<number>@s.whatsapp.net, so/user/infoand/user/avatarwith a phone number hang until the 75s IQ timeout and return 500.Change
ParseJIDstrips the+fromJID.Userwhen the server iss.whatsapp.net.CreateJIDis unchanged, soIsOnWhatsAppstill gets the+.TestParseJIDexpected the+in the output. Updated it and added cases for a number with+, a full JID with+, and a LID.The strip before
SendMessageinsend_service.gois now redundant for JIDs built byParseJID, but I left it in place to keep this change small.Testing
Against a connected instance:
POST /user/info{"number":["55…"]}POST /user/info{"number":["+55…"]}POST /user/avatar{"number":"55…"}POST /user/checkPOST /send/textgo build ./...,go vetandgo test ./pkg/...pass.Note: to connect on current develop I had to bump
waVersionin thewhatsmeow-libsubmodule locally (the pinned version getsClient outdated (405)). That change is not part of this PR.Summary by Sourcery
Normalize WhatsApp user JIDs to prevent failed queries caused by plus-prefixed phone numbers.
Bug Fixes:
+so user information and avatar requests are addressed correctly instead of timing out.Enhancements: