Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion lib/jsonapi/resource.rb
Original file line number Diff line number Diff line change
Expand Up @@ -638,7 +638,12 @@ def is_filter_relationship?(filter)

def verify_filter(filter, raw, context = nil)
filter_values = []
filter_values += CSV.parse_line(raw) unless raw.nil? || raw.empty?

begin
filter_values += CSV.parse_line(raw) unless raw.nil? || raw.empty?
rescue CSV::MalformedCSVError => ex
filter_values << raw
end

strategy = _allowed_filters.fetch(filter, Hash.new)[:verify]

Expand Down
9 changes: 9 additions & 0 deletions test/integration/requests/request_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,15 @@ def test_get_underscored_key
JSONAPI.configuration = original_config
end

def test_filter_with_value_containing_double_quote
original_config = JSONAPI.configuration.dup
JSONAPI.configuration.json_key_format = :underscored_key
get '/iso_currencies?filter[country_name]="'
assert_jsonapi_response 200
ensure
JSONAPI.configuration = original_config
end

def test_get_underscored_key_filtered
original_config = JSONAPI.configuration.dup
JSONAPI.configuration.json_key_format = :underscored_key
Expand Down