Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed a broken JSON in log output #464

Merged
merged 1 commit into from
Jun 29, 2024
Merged

Conversation

willnet
Copy link
Contributor

@willnet willnet commented Jun 18, 2024

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.

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
Copy link

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

@route
Copy link
Member

route commented Jun 26, 2024

We need to address linter issues

@route route merged commit 639fa52 into rubycdp:main Jun 29, 2024
5 of 7 checks passed
@willnet willnet deleted the fix-wrong-sub branch July 4, 2024 02:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants