Closed
Conversation
| version=$(curl -fsSL -o /dev/null -w '%{url_effective}\n' \ | ||
| https://github.com/dokploy/dokploy/releases/latest 2>/dev/null | \ | ||
| sed 's#.*/tag/##') | ||
| version=$(curl -s https://api.github.com/repos/dokploy/dokploy/releases/latest | grep "\"tag_name\":" | cut -d "\"" -f 4) |
There was a problem hiding this comment.
GitHub API rate limit (60 req/hour unauthenticated) will cause failures for users. The previous redirect-following approach didn't count against API limits.
Suggested change
| version=$(curl -s https://api.github.com/repos/dokploy/dokploy/releases/latest | grep "\"tag_name\":" | cut -d "\"" -f 4) | |
| version=$(curl -fsSL -o /dev/null -w '%{url_effective}\n' \ | |
| https://github.com/dokploy/dokploy/releases/latest 2>/dev/null | \ | |
| sed 's#.*/tag/##') |
| version=$(curl -fsSL -o /dev/null -w '%{url_effective}\n' \ | ||
| https://github.com/dokploy/dokploy/releases/latest 2>/dev/null | \ | ||
| sed 's#.*/tag/##') | ||
| version=$(curl -s https://api.github.com/repos/dokploy/dokploy/releases/latest | grep "\"tag_name\":" | cut -d "\"" -f 4) |
There was a problem hiding this comment.
Missing -f flag means curl won't fail on HTTP errors (403, 404, etc). HTTP errors will pass through to grep and fail silently.
Suggested change
| version=$(curl -s https://api.github.com/repos/dokploy/dokploy/releases/latest | grep "\"tag_name\":" | cut -d "\"" -f 4) | |
| version=$(curl -fsSL https://api.github.com/repos/dokploy/dokploy/releases/latest 2>/dev/null | grep "\"tag_name\":" | cut -d "\"" -f 4) |
| version=$(curl -fsSL -o /dev/null -w '%{url_effective}\n' \ | ||
| https://github.com/dokploy/dokploy/releases/latest 2>/dev/null | \ | ||
| sed 's#.*/tag/##') | ||
| version=$(curl -s https://api.github.com/repos/dokploy/dokploy/releases/latest | grep "\"tag_name\":" | cut -d "\"" -f 4) |
There was a problem hiding this comment.
Parsing JSON with grep | cut is fragile. Consider using jq with fallback:
version=$(curl -fsSL https://api.github.com/repos/dokploy/dokploy/releases/latest 2>/dev/null | jq -r '.tag_name // empty' 2>/dev/null || \
curl -fsSL -o /dev/null -w '%{url_effective}\n' https://github.com/dokploy/dokploy/releases/latest 2>/dev/null | sed 's#.*/tag/##')
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The previous GitHub release request wasn't stable, and I had issues with that. I've made it more stable.
Greptile Summary
Changed GitHub release version detection from redirect-following to API endpoint parsing. While the API approach may seem more direct, it introduces critical issues:
-fflag means HTTP errors won't trigger the fallback mechanism properlygrep | cutinstead of a proper JSON parser risks breaking with formatting changesThe previous redirect-following method was more robust as it didn't count against API limits and was the recommended approach for public installation scripts.
Confidence Score: 1/5
Last reviewed commit: 59c90c8