Skip to content

CLI: sanitize/validate uses of the bundled app name per context - #5743

Open
nicoburns wants to merge 1 commit into
mainfrom
devin/1786027330-sanitize-app-name
Open

CLI: sanitize/validate uses of the bundled app name per context#5743
nicoburns wants to merge 1 commit into
mainfrom
devin/1786027330-sanitize-app-name

Conversation

@nicoburns

Copy link
Copy Markdown
Member

Summary

Builds on #5533 (its commit is included), which lets application.name in Dioxus.toml override the bundled app name. That name flows into many contexts with different rules (file names, XML, NSIS script literals, identifiers), so this PR makes each use context-appropriate instead of interpolating the raw display name everywhere:

  • Split display name vs. file name. New BuildRequest::bundled_app_file_name() / BundleContext::product_file_name() always return the PascalCase crate name (pre-feat(cli): Set bundle application name from config #5533 behavior) and are now used for artifact file names and identity-bearing values, so those stay shell-friendly and stable when the display name changes:
    • .msi/NSIS installer file names and .wxs/.wixobj/.nsi intermediates
    • the MSI upgrade-code UUID seed (changing application.name no longer changes the upgrade code)
    • .ipa and .aab file names, updater .app.tar.gz archives, the Linux resource dir
    • the default bundle identifier fallback, now com.example.{PascalCrateName} — a display name with spaces would otherwise produce an invalid CFBundleIdentifier / Android application ID
  • Display name stays verbatim where users see it (plists, launcher labels, installer UI, shortcuts, install dirs, .desktop Name=, the .app directory), but is validated once at BuildRequest::new: validate_bundled_app_name rejects empty names, leading/trailing whitespace, a trailing ., control chars, and / \ : * ? " < > | (it is used as a file name in the .app dir and Windows shortcuts). Spaces and unicode are allowed — that's the point of feat(cli): Set bundle application name from config #5533.
  • Escape template interpolations. The windows bundler's render_template intentionally disables Handlebars escaping (for \{{...}} path handling), so text values were injected raw:
    • WiX: product_name, publisher, short_description now go through xml_escape (e.g. "Tom & Jerry's" no longer produces invalid XML)
    • NSIS: same values plus copyright and start_menu_folder go through nsis_escape ($$$, "$\")
    • Linux .desktop generation now uses handlebars::no_escape — it previously HTML-escaped names into e.g. Name=Foo &amp; Bar
  • Cleanup: build/windows.rs had its own config.application.name fallback for the exe's ProductName resource; it now just calls bundled_app_name().

Testing

  • Unit tests for validate_bundled_app_name, xml_escape, nsis_escape
  • cargo fmt --check, cargo clippy -p dioxus-cli --all-features --all-targets, dx config schema (no schema changes)

Link to Devin session: https://dioxus.staging.devinenterprise.com/sessions/05868b37e8e249ecbd616270007bc37a
Requested by: @nicoburns

@nicoburns nicoburns self-assigned this Aug 6, 2026
@staging-devin-ai-integration

Copy link
Copy Markdown
Contributor

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR that start with 'DevinAI' or '@devin'.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment, CI, and merge conflict monitoring

@staging-devin-ai-integration
staging-devin-ai-integration Bot force-pushed the devin/1786027330-sanitize-app-name branch from 7278be5 to 4b0f30f Compare August 6, 2026 17:00
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.

1 participant