-
Notifications
You must be signed in to change notification settings - Fork 71
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
String operator STR_STARTS_WITH is not evaluated correctly when case-sensative is disabled #238
Comments
Very apt catch, @wseibel . // if-clause checks v.startsWith(c) It is obvious to fix. |
I think v and c both need to be interchanged in if clause. |
@rishiraj88 thanks for the quick reply. You're absolutely right. |
A big thanks to both of you, great report, I'll get a fix out, and add a test so we catch it if it happens again. |
There had been an inversion of variable usage for one of our cases in the matcher. This PR makes sure to compare contextValue to see if it starts with the requested value in the constraint, instead of the other way around. fixes #238
Handled in #240 |
* fix: check that contextValue starts with There had been an inversion of variable usage for one of our cases in the matcher. This PR makes sure to compare contextValue to see if it starts with the requested value in the constraint, instead of the other way around. fixes #238
Added in 9.2.1, should be synced to most mirrors by now. This https://repo1.maven.org/maven2/io/getunleash/unleash-client-java/9.2.1/ is at least present on central |
Describe the bug
When using the STR_STARTS_WITH operator as a constraint on any context field with case-sensitive de-activated, the constraint is always evaluates to false.
Steps to reproduce the bug
Create an activation strategy for an enabled feature-toggle and update it with the following definition
Now evaluate the feature toggle you updated the strategy for with any user-id that starts with "0".
The result is "disabled".
Expected behavior
The evaluation result should return the variation with the name "a".
Logs, error output, etc.
No response
Screenshots
No response
Additional context
When looking into the code the error is easy to spot
The comparison is the wrong way around as can be seen in the else-branch or any other method in this class, where it's done correctly.
Unleash version
No response
Subscription type
None
Hosting type
None
SDK information (language and version)
unleash-client-java:9.2.0
The text was updated successfully, but these errors were encountered: