fix: handle trailing whitespace in version parsing on Windows#12
Merged
taiki-e merged 1 commit intotaiki-e:mainfrom Sep 28, 2025
Merged
fix: handle trailing whitespace in version parsing on Windows#12taiki-e merged 1 commit intotaiki-e:mainfrom
taiki-e merged 1 commit intotaiki-e:mainfrom
Conversation
Fixes version parsing failures on Windows caused by trailing carriage returns (\r) in JSON responses from crates.io API. This prevents installation failures when using non-semver version specifications like 'tool@2'.
Contributor
Author
|
Edit: It seems to have re-ran and resolved itself, so nevermind.
|
Owner
|
Published in 2.3.1. TBH, I'm not sure why we need this since we're passing the -b flag to jq, but this seems to be working anyway, so it's fine for now. (If we cannot trust -b flag, then it's fine to always call |
chitoku-k
added a commit
to chitoku-k/cache-cargo-install-action
that referenced
this pull request
Jan 9, 2026
…taiki-e#12)" This reverts commit 54a6f44.
chitoku-k
added a commit
to chitoku-k/cache-cargo-install-action
that referenced
this pull request
Jan 9, 2026
…taiki-e#12)" This reverts commit 54a6f44.
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.
Problem
The
cache-cargo-install-actionfails on Windows when installing tools with partial version specifications (e.g.,tauri-cli@2), while working correctly on other platforms.Configuration
Expected Behavior
The action should install the latest stable version of
tauri-clithat matches major version 2 (currently2.8.0), equivalent to running:cargo install tauri-cli --version '^2.0.0' --lockedActual Behavior
On Windows runners, the action fails with:
Workflow Failure Log
Root Cause
The version parsing logic in
pre.shdoesn't handle trailing carriage return characters (\r) that can appear in JSON responses from the crates.io API on Windows systems. This causes the regex validation to fail when matching version strings.Solution
${v%%[[:space:]]}) before regex validationTesting
No testing was added into this PR directly, but I tested it manually in my own project: