Repository navigation
fix(search): prevent username prefix me from matching user:me (#1665) - #1667
Closed
granbellllc-png wants to merge 1 commit into
Closed
granbellllc-png wants to merge 1 commit into
granbellllc-png wants to merge 1 commit into
Conversation
…he#1665) - In parseUserID, extract username from user:(\S+) before checking for 'me' - Only treat query as current user search if exact username token is 'me' - Add unit tests for parseUserID with user:me and usernames prefixed with me Fixes apache#1665
Member
|
Thanks for the contribution! This issue has already been fixed in #1666, which is merged into |
Author
|
Thank you @LinkinStars for the review and update! Understood that #1666 already addressed this in dev. Closing this PR accordingly. |
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 #1665.
Motivation
When searching
user:<username>where the username begins withme(such asuser:melissa), the parser previously executedstrings.Contains(q, "user:me")before checking the username regex. This causeduser:melissato be matched asuser:me, replacinguser:mewith empty string and leavinglissato be searched as a separate word query.Fix
parseUserID, extract the full username token viauser:(\S+)first."me"to assigncurrentUserID.GetUserBasicInfoByUserNamefor the exact username.internal/service/search_parser/search_parser_test.go.