[TIMOB-17369] CLI: Auto-escape quotes in tiapp.xml
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Low |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2014-09-03T17:47:52.000+0000 |
Affected Version/s | n/a |
Fix Version/s | Release 4.0.0 |
Components | CLI |
Labels | ft |
Reporter | Joshua Rhinehart |
Assignee | Tim Poulsen |
Created | 2014-07-22T21:27:34.000+0000 |
Updated | 2014-10-03T21:02:07.000+0000 |
Description
Using double quotes in the description field of your tiapp.xml causes errors at build-time, perhaps we could warn users not to use that character before they build the project, or escape the string if possible. See error below:
[ERROR] Failed to compile Java source files:
[ERROR]
[ERROR] /Users/jrhinehart/Documents/Appcelerator_Studio_Workspace/8dupe_test WW/build/android/gen/com/appc/dupetestnew/_8dupe_testWwAppInfo.java:48: ';' expected
[ERROR] return "Test for 'Duplicate app icons on install" bug - Verified for 52.09 of MATT utility";
[ERROR] ^
I assume this also happens if you build from the CLI?
Yes, it occurs when building from both Studio and CLI
Note: The issue seemed to apply to only Android. In my testing with release-versions of the SDK, iOS and MobileWeb build fine when there are quotes in the description field. So the PR below escapes quotes for only Android builds. PR: https://github.com/appcelerator/titanium_mobile/pull/5986
sample app code
Functional test: 1. Create a new Titanium project and replace its app.js with the code above. 2. Edit the tiapp.xml to set the description to
description with "double quotes" and 'single quotes' inside, even an ' unmatched apostrophe
3. Build for Android withti build -p android
. The app should build & run without errors and display a single label, which contains the contents of the description with quotes shown properly (unescaped) 4. Build for iOS and/or MobileWeb, which should likewise show the label with the string properly formatted.PR updated per comment on the pull. For the test app, there's no need to test the single quotes as I described. But it doesn't hurt to test as shown. Code should work either way.
Verified the fix. Tested with double quotes, single quotes & apostrophe & didn't get any errors. Closing. Environment: Appc Studio : 3.4.0.201409261245 Ti SDK : 3.5.0.v20141002192515 Mac OSX : 10.9.4 Alloy : 1.5.1 CLI - 3.4.0 Code Processor: 1.1.1 Nexus5 - Android 4.4.4