Open catsby opened 2 weeks ago
Did someone external create an issue for this or was it something you found? I would say we just error out and abort if someone tries to use a bad name
@decleaver it came from me. I was working through onboarding things and for reasons I don't recall I had a space in my bundle name ("example doom game"
or something) and noticed the resulting tarball had spaces in the file name that had to be escaped if I wanted to reference it
+1 to aborting and erroring out, but when we do, show the user how they can fix the error
"I want to not break things and not be terribly surprising" - @catsby
Description
Prevent special characters in bundle names, which ultimately affect the tarball filename but are in general probably not a good idea to allow anyway.
In this PR if a bundle's name contains non letters, numbers, or hyphens, uds-cli will error. If the name is valid then we remove all leading and trailing spaces (
" "
), lowercase everything, and replace any remaining spaces with hyphens.Ex:
worDpress
->wordpress
" Word pRess "
->word-press
It's currently possible to use a bundle name with odd characters or even spaces which result in tarball artifacts with either the special characters or spaces in the name.
Example:
The
name
here is unlikely but still validOutput (trimmed):
Generates this file:
Note:
This is currently a draft for review and feedback on next steps. It's not entirely clear if we should outright error and abort initially, or if we should at first output some kind of warning that the name is not valid and in the future we'll error, to enable a sort of grace period.
Related Issue
Fixes #886
Type of change
Checklist before merging