Skip to content

Commit

Permalink
Fixes #451.
Browse files Browse the repository at this point in the history
Removes side effect on passed `value` param when it's escaped
  • Loading branch information
lkalwa committed May 17, 2023
1 parent ab2de8f commit 64ce8d3
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/graphiti/scoping/filter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -193,14 +193,14 @@ def parse_string_arrays(value, singular_filter)
# Find the quoted strings
quotes = value.scan(/{{.*?}}/)
# remove them from the rest
quotes.each { |q| value.gsub!(q, "") }
non_quotes = quotes.inject(value) { |v, q| v.gsub(q, "") }
# remove the quote characters from the quoted strings
quotes.each { |q| q.gsub!("{{", "").gsub!("}}", "") }
# merge everything back together into an array
value = if singular_filter
Array(value) + quotes
Array(non_quotes) + quotes
else
Array(value.split(",")) + quotes
Array(non_quotes.split(",")) + quotes
end
# remove any blanks that are left
value.reject! { |v| v.length.zero? }
Expand Down

0 comments on commit 64ce8d3

Please sign in to comment.