Skip to content

fix: @W-23480808 - map parent folder for all entries in compression and add additional bundle name validation - #64

Merged
william-xie-sf merged 6 commits into
mainfrom
t/ui-bundles-miyo/w-23480808/map-parent-folder-compression
Jul 18, 2026
Merged

fix: @W-23480808 - map parent folder for all entries in compression and add additional bundle name validation#64
william-xie-sf merged 6 commits into
mainfrom
t/ui-bundles-miyo/w-23480808/map-parent-folder-compression

Conversation

@william-xie-sf

Copy link
Copy Markdown
Contributor

What does this PR do?

  • Resolve an error from serverside validation where zip file entries don't explicitly specify common parent folder
  • Change UiBundleUploadValidationError -> UiBundleUploadError to better reflect its purpose and usage

What issues does this PR fix or reference?

@W-23480808@

@william-xie-sf
william-xie-sf marked this pull request as ready for review July 16, 2026 20:53
@william-xie-sf
william-xie-sf requested a review from a team as a code owner July 16, 2026 20:53
@ankit-patro-sf

Copy link
Copy Markdown

Nice- nesting under a single wrapper dir is the right call, and keeping it CLI-side (vs. relaxing the server guard) is exactly what we want. One gap before this fully closes the server-validation error, though:

**basename(dir)** isn't sanitized against the server's top-dir naming rule.
The Connect API doesn't just require one top-level dir — it also enforces the developer-name allowlist on that dir name (UiBundleDeployService.validateZip):

if (!topDir.matches("[A-Za-z][A-Za-z0-9_]*"))
  throw badRequest("bundle directory name '" + topDir + "' does not match the allowed pattern [A-Za-z][A-Za-z0-9_]*");

Must start with a letter; only letters/digits/underscores after. Since we pass basename(dir) through verbatim, common directory names still 400 — just with a different validation message:

--bundle-dir ./my-bundle → hyphen → rejected
--bundle-dir ./2048-app → leading digit + hyphen → rejected
./my.app, ./hello world → dot / space → rejected

The unit tests don't surface this because they stub the connection (server validation never runs) and the mkdtemp fixtures happen to be hyphenated (upload-test-dir-…) but are only asserted structurally.

Suggestion: Reconcile the wrapper name with requestedName/--bundle-name (the developer name should match it anyway), or sanitize basename to the allowlist and fail early with a clear CLI error when it can't be made valid — sanitizing silently risks a mismatch with requestedName, so aligning the two reads cleaner. A test with a hyphenated --bundle-dir name (asserting the produced wrapper is allowlist-valid) would lock it in.

Minor: --zip-file (BYO zip) is untouched, so a pre-flattened zip still trips the server guard — probably fine to leave as the user's responsibility, but worth a note in the PR body since it currently reads as a blanket fix.

@ankit-patro-sf ankit-patro-sf left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@william-xie-sf william-xie-sf changed the title @W-23480808 - fix: map parent folder for all entries in compression fix: map parent folder for all entries in compression and add additional bundle name validation Jul 17, 2026
@william-xie-sf william-xie-sf changed the title fix: map parent folder for all entries in compression and add additional bundle name validation fix: @W-23480808 map parent folder for all entries in compression and add additional bundle name validation Jul 17, 2026
@william-xie-sf william-xie-sf changed the title fix: @W-23480808 map parent folder for all entries in compression and add additional bundle name validation fix: @W-23480808 - map parent folder for all entries in compression and add additional bundle name validation Jul 17, 2026
@william-xie-sf
william-xie-sf merged commit 764db81 into main Jul 18, 2026
15 of 16 checks passed
@william-xie-sf
william-xie-sf deleted the t/ui-bundles-miyo/w-23480808/map-parent-folder-compression branch July 18, 2026 02:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants