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

install: handle GitHub API JSON without newlines #2176

Merged
merged 1 commit into from
Dec 9, 2024

Conversation

bendrucker
Copy link
Member

@bendrucker bendrucker commented Dec 6, 2024

Handles GitHub API responses that do not include newlines. Previously, if the releases/latest response lacked newlines within its JSON, get_latest_release would return mentions_count since that is the last double-quoted string on the line grep matched (the whole object).

Now, sed will only capture the string value after "tag_name". It looks past a colon and optional surrounding whitespace and captures the next double quoted group. This is compatible with both compact and multiline JSON.

We still need grep to handle multiline JSON, since we need to exclude all lines other than the one we want. Otherwise the output is the original object with a single malformed line containing the latest version. GNU sed can handle multiline input with -z so keeping grep for that preserves portability.

Closes #2175

@bendrucker bendrucker requested a review from wata727 December 6, 2024 19:25
Copy link
Member

@wata727 wata727 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@bendrucker bendrucker merged commit 6188f87 into master Dec 9, 2024
14 checks passed
@bendrucker bendrucker deleted the install-script-handle-compact-json branch December 9, 2024 05:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

Trying to download mentions_count as a version
2 participants