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

Parsing filter values with {{}} has unwanted side effects. #451

Closed
lkalwa opened this issue Apr 21, 2023 · 0 comments · Fixed by #452
Closed

Parsing filter values with {{}} has unwanted side effects. #451

lkalwa opened this issue Apr 21, 2023 · 0 comments · Fixed by #452

Comments

@lkalwa
Copy link
Contributor

lkalwa commented Apr 21, 2023

Parsing without curlies:

[1] pry(main)> value = "*name*"
=> "*name*"
[2] pry(main)> Graphiti::Scoping::Filter.new(nil, nil, nil).parse_string_arrays(value, false)
=> "*name*"
[3] pry(main)> value
=> "*name*"

Parsing with curlies:

[4] pry(main)> value = "{{*name*}}"
=> "{{*name*}}"
[5] pry(main)> Graphiti::Scoping::Filter.new(nil, nil, nil).parse_string_arrays(value, false)
=> "*name*"
[6] pry(main)> value
=> ""

In the latter case if you want to reuse the value for anything it's lost.
All of that happens because of this line:
https://github.com/graphiti-api/graphiti/blob/master/lib/graphiti/scoping/filter.rb#L196
There is a gsub! on a value passed to the method that causes described side effect.

lkalwa added a commit to lkalwa/graphiti that referenced this issue May 16, 2023
lkalwa added a commit to lkalwa/graphiti that referenced this issue May 16, 2023
lkalwa added a commit to lkalwa/graphiti that referenced this issue May 17, 2023
Removes side effect on passed `value` param when it's escaped
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

Successfully merging a pull request may close this issue.

1 participant