Skip to content

Commit 9e69db7

Browse files
author
Martii
committed
Bypass notices on certain unicode strings.
* OpenUserJS#819 is rearing it's ugly head here **NOTES** Will have to spend some more time on this for that issue but as I stated it's roughed in Applies to OpenUserJS#432
1 parent 89a2f7b commit 9e69db7

File tree

1 file changed

+14
-5
lines changed

1 file changed

+14
-5
lines changed

libs/modelParser.js

+14-5
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,7 @@ var parseScript = function (aScriptData) {
119119

120120
var downloadURL = null;
121121
var rAlternateDownload = null;
122+
var skipAlternateDownloadValidation = false;
122123

123124
// Temporaries
124125
var htmlStub = null;
@@ -169,10 +170,18 @@ var parseScript = function (aScriptData) {
169170
// Download Url
170171
downloadURL = findMeta(script.meta, 'UserScript.downloadURL.0.value');
171172
if (downloadURL) {
172-
rAlternateDownload = new RegExp(
173-
'^https?://(?:openuserjs\.org|localhost:' + (process.env.PORT || 8080) +
174-
')/(?:install|src/scripts)/' +
175-
script.installName.replace(/\.user\.js$/, '.min.user.js'));
173+
174+
console.log(script.installName);
175+
176+
try {
177+
rAlternateDownload = new RegExp(
178+
'^https?://(?:openuserjs\.org|localhost:' + (process.env.PORT || 8080) +
179+
')/(?:install|src/scripts)/' +
180+
script.installName.replace(/\.user\.js$/, '.min.user.js'));
181+
} catch (aE) {
182+
console.warn('Unicode issue with ' + script.installName);
183+
skipAlternateDownloadValidation = true;
184+
}
176185

177186
try {
178187
downloadURL = decodeURIComponent(downloadURL);
@@ -182,7 +191,7 @@ var parseScript = function (aScriptData) {
182191
script.showMinficationNotices = true;
183192
}
184193

185-
if (!rAlternateDownload.test(downloadURL)) {
194+
if (!skipAlternateDownloadValidation && !rAlternateDownload.test(downloadURL)) {
186195
script.hasAlternateDownloadURL = true;
187196
script.showMinficationNotices = true;
188197
}

0 commit comments

Comments
 (0)