rubycdp / ferrum

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

Fixed a broken JSON in log output #464

Closed willnet closed 1 week ago

willnet commented 2 weeks 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 1 week ago

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

route commented 1 week ago

We need to address linter issues