-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PTV-1911: Fix user search bugs re underscores + mongo errors #439
Conversation
* Fixed a bug where if a user name contained an underscore and the search term included the underscore followed by at least one letter the search wouldn't match * Fixed a bug where if the search terms were all illegal characters such that the search list was empty for a requested search a mongo error would be thrown
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #439 +/- ##
=============================================
- Coverage 93.37% 93.37% -0.01%
- Complexity 2144 2151 +7
=============================================
Files 126 126
Lines 7531 7558 +27
Branches 1178 1184 +6
=============================================
+ Hits 7032 7057 +25
- Misses 456 458 +2
Partials 43 43 |
@@ -35,8 +39,8 @@ public class UserName extends Name { | |||
} | |||
} | |||
|
|||
private static final String INVALID_CHARS_REGEX = "[^a-z\\d_]+"; | |||
private final static Pattern INVALID_CHARS = Pattern.compile(INVALID_CHARS_REGEX); | |||
private static final Pattern FORCE_ALPHA_FIRST_CHAR = Pattern.compile("^[^a-z]+"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I hope 2pac never made a KBase account!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure how deep KBase has penetrated into the gangsta rap community
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Something to check with KBase outreach about.
private static final String INVALID_CHARS_REGEX = "[^a-z\\d_]+"; | ||
private final static Pattern INVALID_CHARS = Pattern.compile(INVALID_CHARS_REGEX); | ||
private static final Pattern FORCE_ALPHA_FIRST_CHAR = Pattern.compile("^[^a-z]+"); | ||
private final static Pattern INVALID_CHARS = Pattern.compile("[^a-z\\d_]+"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you use \\W+
, since \w
is equivalent to [a-z0-9_]
in most regex implementations?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That would work, but my personal preference is to use the more explicit form where you don't have to look up what W
means
Fixes #435