Skip to content

Commit

Permalink
fix(ApkParser): versionName special chars filter
Browse files Browse the repository at this point in the history
  • Loading branch information
chenquincy committed Jun 15, 2021
1 parent ef91d41 commit de6db75
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 4 deletions.
5 changes: 5 additions & 0 deletions dist/app-info-parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -1641,6 +1641,11 @@ var BinaryXmlParser = /*#__PURE__*/function () {
attr.nodeName = attr.name = this.strings[nameRef];

if (valueRef > 0) {
// some apk have versionName with special characters
if (attr.name === 'versionName') {
this.strings[valueRef] = this.strings[valueRef].replace(/[^\d\w-.]/g, '');
}

attr.value = this.strings[valueRef];
}

Expand Down
4 changes: 2 additions & 2 deletions dist/app-info-parser.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/app-info-parser.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/app-info-parser.min.js.map

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions lib/xml-parser/binary.js
Original file line number Diff line number Diff line change
Expand Up @@ -543,6 +543,10 @@ and is supposed to end at offset ${end}. Ignoring the rest of the value.`)
attr.nodeName = attr.name = this.strings[nameRef]

if (valueRef > 0) {
// some apk have versionName with special characters
if (attr.name === 'versionName') {
this.strings[valueRef] = this.strings[valueRef].replace(/[^\d\w-.]/g, '')
}
attr.value = this.strings[valueRef]
}

Expand Down

0 comments on commit de6db75

Please sign in to comment.