Skip to content
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

Constrain using CONTAINS filter always fails. #400

Closed
DoryZi opened this issue Sep 11, 2020 · 2 comments
Closed

Constrain using CONTAINS filter always fails. #400

DoryZi opened this issue Sep 11, 2020 · 2 comments

Comments

@DoryZi
Copy link

DoryZi commented Sep 11, 2020

Contains will work well for srtings

When using contains constrain, it fails to detect that a entity_context parameter, actually contains the string.
We see that equal works fine, but contains seems to fail regardless of the value.

I.E.

"msg": "Literal is not a slice of string: \"http://localhost:8000/products/31982887829566/confirmation/?funnel=start&site=because&did=1732a3747268a-02f8335de7751d-1b396256-13c680-1732a374727189&variant=31982887829566&addons_before=true&product_position=2&product_position_variant=29600123486278&addons=&trial_addons=&utm_content=taboola\"",

I've also tried to simplify in case there is some url encoding going:

"msg": "Literal is not a slice of string: \"utm_content=taboola\""

My constrain in the simplest definition as
Property: evaluate_url
CONTAINS
Value: "utm_content"

Here is the test request I sent in the simplest form:

{
  "entityID": "a1234",
  "entityType": "report",
  "entityContext": {
    "evaluate_url": "utm_content=taboola"
    
  },
  "enableDebug": true,
  "flagID": 2,
  "flagKey": "*************"
}

Possible Solution

Not a go expect but I suspect that the way it's sliced and matches is incorrect.

Steps to Reproduce (for bugs)

  • Setup a flag with constrain, as per my example above
  • Run the test in the Flagr UI with debug. Equal works fine, contains always fails.

Context

Your Environment

  • Version used (flagr version):
  • Server type and version:
  • Operating System and version (uname -a):
  • Link to your project:
@zhouzhuojie
Copy link
Collaborator

Related link: zhouzhuojie/conditions#11 (comment)

CONTAINS only works for [array] contains item, if you want substring, the regex operator =~ can help.

@DoryZi
Copy link
Author

DoryZi commented Sep 14, 2020

Thanks! Amazing work on Flagr!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants