feat: Validate and format bundle names to exclude special characters #914
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.
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