rubycdp / ferrum

Headless Chrome Ruby API
https://ferrum.rubycdp.com
MIT License
1.76k stars 127 forks source link

Fixed a broken JSON in log output #464

Closed willnet closed 4 months ago

willnet commented 5 months ago

Since v0.15, a JSON format in the log output has been broken. When the original log is in the following format:

"{\"id\":27,\"result\":{\"data\":\"(snipped)\"},\"sessionId\":\"E2C753A9154794C390311B8647590A03\"}"

It gets converted to a format without a closing } like this:

"    ◀ 10.680710212999657 {\"id\":27,\"result\":\"Set FERRUM_LOGGING_SCREENSHOTS=true to see screenshots in Base64\"\n"

Upon investigation, I found that the string replacement performed when SKIP_LOGGING_SCREENSHOTS is enabled was unintentionally breaking the JSON format. Therefore, I modified the regular expression used for the replacement.

botandrose commented 4 months ago

+1 from me. Came here to submit more or less the same PR, just making the regex non-greedy. /{"data":"(.*?)"}/.

route commented 4 months ago

We need to address linter issues