-
-
Notifications
You must be signed in to change notification settings - Fork 26
fix(pixlet): resolve the release tag correctly when downloading #461
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -24,9 +24,20 @@ echo "========================================" | |||||||||
| # Auto-detect latest version if needed | ||||||||||
| if [ "$PIXLET_VERSION" = "latest" ]; then | ||||||||||
| echo "Detecting latest version..." | ||||||||||
| PIXLET_VERSION=$(curl -s "https://api.github.com/repos/${REPO}/releases/latest" | grep '"tag_name"' | sed -E 's/.*"([^"]+)".*/\1/') | ||||||||||
| if [ -z "$PIXLET_VERSION" ]; then | ||||||||||
| echo "Failed to detect latest version, using fallback" | ||||||||||
| # GitHub returns this JSON on a single line, so `grep '"tag_name"'` | ||||||||||
| # matches the whole document and a greedy `sed 's/.*"([^"]+)".*/\1/'` | ||||||||||
| # captures the LAST quoted token in it rather than the tag. That resolved | ||||||||||
| # to "mentions_count", which built a download URL for a release that does | ||||||||||
| # not exist. Match the field itself and take the value after it. | ||||||||||
| PIXLET_VERSION=$(curl -fsSL "https://api.github.com/repos/${REPO}/releases/latest" \ | ||||||||||
| | grep -o '"tag_name"[[:space:]]*:[[:space:]]*"[^"]*"' \ | ||||||||||
| | head -n1 \ | ||||||||||
| | sed -E 's/.*:[[:space:]]*"([^"]*)".*/\1/') | ||||||||||
|
|
||||||||||
| # A wrong-but-non-empty value is what made the old bug silent, so check | ||||||||||
| # the shape rather than just that something came back. | ||||||||||
| if ! printf '%s' "$PIXLET_VERSION" | grep -qE '^v?[0-9]+\.[0-9]+'; then | ||||||||||
| echo "Could not detect the latest version (got: '${PIXLET_VERSION:-<empty>}'), using fallback" | ||||||||||
| PIXLET_VERSION="v0.50.2" | ||||||||||
| fi | ||||||||||
| fi | ||||||||||
|
|
@@ -67,8 +78,19 @@ download_binary() { | |||||||||
| temp_dir=$(mktemp -d -p "$PROJECT_ROOT" -t pixlet_download.XXXXXXXXXX) | ||||||||||
| local temp_file="$temp_dir/$archive_name" | ||||||||||
|
|
||||||||||
| if ! curl -L -o "$temp_file" "$url" 2>/dev/null; then | ||||||||||
| echo "✗ Failed to download $arch" | ||||||||||
| # -f so an HTTP error is a failure. Without it curl writes the 404 body | ||||||||||
| # to the file and exits 0, and the first sign of trouble is tar saying | ||||||||||
| # "not in gzip format" about what is actually a page of HTML. | ||||||||||
| if ! curl -fL -o "$temp_file" "$url" 2>/dev/null; then | ||||||||||
| echo "✗ Failed to download $arch from $url" | ||||||||||
| rm -rf "$temp_dir" | ||||||||||
| return 1 | ||||||||||
| fi | ||||||||||
|
|
||||||||||
| # Belt and braces: a mirror or proxy can return 200 with an error page. | ||||||||||
| if ! gzip -t "$temp_file" 2>/dev/null; then | ||||||||||
| echo "✗ Downloaded file is not a gzip archive: $url" | ||||||||||
| echo " (first bytes: $(head -c 60 "$temp_file" | tr -d '\0' | tr '\n' ' '))" | ||||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🔒 Security & Privacy | 🟡 Minor | ⚡ Quick win Print invalid-response diagnostics as escaped data. Line 93 prints external response bytes through Proposed safe diagnostic- echo " (first bytes: $(head -c 60 "$temp_file" | tr -d '\0' | tr '\n' ' '))"
+ local first_bytes
+ first_bytes=$(head -c 60 "$temp_file" | od -An -tx1 -v | tr -d '[:space:]')
+ printf ' (first bytes, hex: %s)\n' "$first_bytes"📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||
| rm -rf "$temp_dir" | ||||||||||
| return 1 | ||||||||||
| fi | ||||||||||
|
|
||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
Repository: ChuckBuilds/LEDMatrix
Length of output: 14504
🏁 Script executed:
Repository: ChuckBuilds/LEDMatrix
Length of output: 591
🌐 Web query:
tronbyt pixlet GitHub release tags version format prerelease build suffix💡 Result:
The project commonly associated with the name Pixlet is hosted at github.com/tidbyt/pixlet (with a fork or related project occasionally referenced as tronbyt/pixlet) [1][2][3][4]. Its release tagging and versioning follow Semantic Versioning (SemVer) principles [5][6][7]. Version Format: Releases are tagged using the vX.Y.Z format (e.g., v0.33.3) [5][6][7]. Prerelease and Build Suffixes: While the primary releases on GitHub use standard tags, the project utilizes Go module versioning, which may generate pseudo-versions in environments like pkg.go.dev [2][8]. These pseudo-versions typically follow the format vX.Y.Z-yyyymmddhhmmss-abcdefabcdef, where: - The base is the last tagged version (e.g., v0.47.3) [2]. - The suffix consists of a timestamp (yyyymmddhhmmss) and a short commit hash (e.g., -0.20251111230017-f1b5948fba28) [2][8]. These are automatically generated by the Go proxy system to represent commits that have not been tagged as official releases, rather than manually defined prerelease or build tags within the Git repository itself [2][8]. Official releases tagged in the GitHub repository generally do not include prerelease or build metadata suffixes [5][7].
Citations:
Anchor the complete Pixlet release-tag match. The current pattern accepts
v0.53garbageand0.53, so invalid tags can reach the release URL. Match the documentedvX.Y.Zformat, with explicitly supported prerelease or build suffixes, and anchor the pattern at both ends.🤖 Prompt for AI Agents