-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: escape strings.xml app name #1384
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.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lgtm
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 add
when the Cordova app name contains the character&
. The issue occurs when parsing thestrings.xml
file. 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 test
and project creation successfulChecklist
(platform)
if this change only applies to one platform (e.g.(android)
)