Skip to content
Closed
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
2 changes: 1 addition & 1 deletion lib/jsonpath.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def initialize(path, opts = {})
nil
elsif (token = scanner.scan(/[><=] \d+/))
@path.last << token
elsif (token = scanner.scan(/./))
elsif (token = scanner.scan(/./m))
begin
@path.last << token
rescue RuntimeError
Expand Down
4 changes: 4 additions & 0 deletions test/test_jsonpath.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1178,6 +1178,10 @@ def test_raise_max_nesting_error
assert_raises(MultiJson::ParseError) { JsonPath.new('$.a', max_nesting: 1).on(json) }
end

def test_linefeed_in_path_error
assert_raises(ArgumentError) { JsonPath.new("$.store\n.book") }
end

def test_with_max_nesting_false
json = {
a: {
Expand Down