fix(cli): escape special characters in Android strings.xml productName (fix #14634)#14920
Open
akuligowski9 wants to merge 2 commits intotauri-apps:devfrom
Open
fix(cli): escape special characters in Android strings.xml productName (fix #14634)#14920akuligowski9 wants to merge 2 commits intotauri-apps:devfrom
akuligowski9 wants to merge 2 commits intotauri-apps:devfrom
Conversation
afed792 to
0cec979
Compare
Author
|
Hi! Just checking in — this PR is ready for review. I've also signed the commits per the branch protection requirements. Would appreciate a look when you get a chance! |
fix tauri-apps#14634) When `productName` contains a single quote (e.g. "Aircraft's Hub"), the generated `strings.xml` was invalid and broke Android builds. Add an `android-string-escape` handlebars helper that escapes XML and Android string resource special characters. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
0cec979 to
f6457b3
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
android-string-escapehandlebars helper that escapes&,<,>,", and'for Android string resourcesstrings.xmltemplate forapp_nameandmain_activity_titleMotivation
When
productNameintauri.conf.jsoncontains a single quote (e.g."Aircraft's Hub"),cargo tauri android initgenerates invalidstrings.xmlthat causesaapt2to fail during Android builds. The handlebars engine is configured withno_escape, so{{app.stylized-name}}is rendered raw.Approach
A new
android-string-escapehelper follows the existing pattern ofhtml-escapeandescape-kotlin-keyword. This keeps escaping explicit and visible in the template rather than silently modifying data before rendering. The helper handles both XML-level entities (&,<,>) and Android string resource conventions (\',\").Test plan
cargo check -p tauri-clicompilescargo clippy -p tauri-cli --no-deps— no new warnings (3 pre-existing needless borrow warnings in unrelated code)cargo test -p tauri-cli— all 47 tests pass"Aircraft's Hub"would produceAircraft\'s Hubin the generated XML🤖 Generated with Claude Code