Summary
When urlbox orgs select lands in an org with several projects, the hint it prints interpolates the organisation name unquoted. Any org name containing an apostrophe or a space produces a command that cannot be pasted into a shell.
Reproduce
-
Be in an org whose name contains an apostrophe — the default "'s Organisation" that Urlbox creates for a new account is exactly this shape.
-
Trigger the multi-project branch without a TTY:
urlbox orgs select "<that org>" | cat
Expected
A copy-pasteable command.
Actual
6 projects in this organisation — run `urlbox orgs select Some User's Organisation --project <name>` or `urlbox projects select` to finish.
Pasting that leaves the shell waiting on an unterminated quote. Even without the apostrophe, the unquoted spaces mean orgs select receives only the first word.
Cause
internal/cmd/orgs.go:212 used %s for the name:
_, _ = fmt.Fprintf(cmd.ErrOrStderr(),
"%d projects in this organisation — run `urlbox orgs select %s --project <name>` or `urlbox projects select` to finish.\n",
projectCount, chosen.Name)
Fix
%q quotes the name and escapes what needs escaping:
"%d projects in this organisation — run `urlbox orgs select %q --project <name>` or `urlbox projects select` to finish.\n",
Output becomes:
run `urlbox orgs select "Some User's Organisation" --project <name>`
which pastes correctly. Other hints that interpolate user-controlled names into suggested commands are worth the same check.
Environment
urlbox 1.2.0 (commit 5530665), Linux.
Summary
When
urlbox orgs selectlands in an org with several projects, the hint it prints interpolates the organisation name unquoted. Any org name containing an apostrophe or a space produces a command that cannot be pasted into a shell.Reproduce
Be in an org whose name contains an apostrophe — the default "'s Organisation" that Urlbox creates for a new account is exactly this shape.
Trigger the multi-project branch without a TTY:
Expected
A copy-pasteable command.
Actual
Pasting that leaves the shell waiting on an unterminated quote. Even without the apostrophe, the unquoted spaces mean
orgs selectreceives only the first word.Cause
internal/cmd/orgs.go:212used%sfor the name:Fix
%qquotes the name and escapes what needs escaping:"%d projects in this organisation — run `urlbox orgs select %q --project <name>` or `urlbox projects select` to finish.\n",Output becomes:
which pastes correctly. Other hints that interpolate user-controlled names into suggested commands are worth the same check.
Environment
urlbox 1.2.0(commit 5530665), Linux.