Open
Description
I'm experiencing a JSON::ParserError
because of a bad character (in my case it's 0x1b
):
Here's the stack trace that showed me where the issue was:
This is the JSON.parse
we're hitting ...
jenkins_api_client/lib/jenkins_api_client/client.rb
Lines 807 to 816 in 72f49f2
I've been able to replicate using this file (jenkins-log-with-bad-character.txt):
[1] pry(main)> file = File.open("/Users/Kingori/Desktop/jenkins-log-with-bad-character.txt")
=> #<File:/Users/Kingori/Desktop/jenkins-log-with-bad-character.txt>
[2] pry(main)> file_data = file.read
=> "{\"comment\":\"Some gems seem to be missing from your /srv/bundle/cache directory.\\n\eCould not find rake-12.3.3 in any of the sources\"}\n"
[3] pry(main)> JSON.parse(file_data)
JSON::ParserError: 783: unexpected token at '{"comment":"Some gems seem to be missing from your /srv/bundle/cache directory.\nould not find rake-12.3.3 in any of the sources"}
'
from /Users/Kingori/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/json-2.3.0/lib/json/common.rb:156:in `parse'
[4] pry(main)> file_data.encoding
=> #<Encoding:UTF-8>
Metadata
Metadata
Assignees
Labels
No labels