fix: escape strings.xml app name#1384
Conversation
|
Wouldn't the correct fix be to XML-escape the |
5632116 to
64ed3b7
Compare
Codecov Report
@@ Coverage Diff @@
## master #1384 +/- ##
==========================================
+ Coverage 73.15% 73.17% +0.01%
==========================================
Files 21 21
Lines 1643 1644 +1
==========================================
+ Hits 1202 1203 +1
Misses 441 441
Continue to review full report at Codecov.
|
jcesarmobile
left a comment
There was a problem hiding this comment.
package.json doesn't include lodash.
It works because there are 3 other dependencies that include lodash as dependency themselves but it could break in the future if those dependencies are replaced/removed or they stop using lodash in a newer version.
So I think it should be included in the package.json to prevent that.
erisu
left a comment
There was a problem hiding this comment.
I am not infavor for installing the entire lodash package just to use one method.
Either install the exact package, lodash.escape, or write our own escape method please.
Lodash
package size: 319.0 kB
unpacked size: 1.4 MB
Lodash Escape
package size: 3.9 kB
unpacked size: 9.1 kB
|
It's already being installed because it's a dependency of other 3 dependencies. I would be in favor of not installing lodash, but that would mean updating a lot of our dependencies (including cordova-common as it depends on @netflix/nerror which depends on lodash) |
|
We have been removing lodash from our dependencies because of the vuln. report frequencies. I have discussed with others on dropping |
To add onto this, we can probably solve the same issue using the JS native method encodeURIComponent so that we can avoid introducing another lodash dependency in the code. I'm pretty sure the method exists in NodeJS environments. |
|
I solved a similar problem in Capacitor using replace like this note that it doesn't include |
|
Here is what lodash escape does, just for additional details: |
|
there is some previous conversion somewhere else, because I tested with |
|
I found where the cordova-android/lib/prepare.js Line 266 in 09c7523 |
d5aa097 to
2f57148
Compare
Platforms affected
Android
Motivation and Context
Error on
cordova platform addwhen the Cordova app name contains the character&. The issue occurs when parsing thestrings.xmlfile. The issue was introduced on cordova-android 10.1.0Fixes #1380
Description
Simply replaces the
&characters in the project name (if present) by an_.Testing
npm testand project creation successfulChecklist
(platform)if this change only applies to one platform (e.g.(android))