fix(cli): reject empty-name target in wheels packages install#2290
Merged
fix(cli): reject empty-name target in wheels packages install#2290
Conversation
`$parseTarget` called `Left(target, Find("@", target) - 1)` without
guarding against targets starting with `@` (e.g., `wheels packages
install @1.0.0`). That evaluates to `Left(str, 0)`, which crashes on
Lucee 7 per the documented gotcha in CLAUDE.md and produces a cryptic
empty-name install attempt on other engines.
Throw `Wheels.Packages.BadInput` explicitly when the name segment is
empty, with a message that points at the correct syntax. Preserves the
existing valid-input paths (no `@`, or `name@version`).
Adds a regression spec in PackagesMainCliSpec.
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.
Summary
PackagesMainCli.\$parseTargetcrashed on Lucee 7 (and produced a cryptic empty-name install on other engines) when invoked with a target that starts with@, e.g.,wheels packages install @1.0.0.Left(target, Find(\"@\", target) - 1)evaluates toLeft(str, 0), which is explicitly called out as a Lucee 7 hazard in CLAUDE.md.Wheels.Packages.BadInputwith a clear syntax hint when the name segment is empty.Spotted while closing out wheels-dev/wheels#2270; the scope of that issue ships via #2276 + #2287 and this is a small defensive follow-up, not a new feature.
Test plan
bash tools/test-cli-local.sh— 437 pass, 0 fail, 0 error (includes new regression specinstall throws BadInput when target starts with '@' (empty name)).