Skip to content

Commit

Permalink
Bypass notices on certain unicode strings.
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
Martii committed Feb 5, 2016
1 parent 89a2f7b commit 9e69db7
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions libs/modelParser.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ var parseScript = function (aScriptData) {

var downloadURL = null;
var rAlternateDownload = null;
var skipAlternateDownloadValidation = false;

// Temporaries
var htmlStub = null;
Expand Down Expand Up @@ -169,10 +170,18 @@ var parseScript = function (aScriptData) {
// Download Url
downloadURL = findMeta(script.meta, 'UserScript.downloadURL.0.value');
if (downloadURL) {
rAlternateDownload = new RegExp(
'^https?://(?:openuserjs\.org|localhost:' + (process.env.PORT || 8080) +
')/(?:install|src/scripts)/' +
script.installName.replace(/\.user\.js$/, '.min.user.js'));

console.log(script.installName);

try {
rAlternateDownload = new RegExp(
'^https?://(?:openuserjs\.org|localhost:' + (process.env.PORT || 8080) +
')/(?:install|src/scripts)/' +
script.installName.replace(/\.user\.js$/, '.min.user.js'));
} catch (aE) {
console.warn('Unicode issue with ' + script.installName);
skipAlternateDownloadValidation = true;
}

try {
downloadURL = decodeURIComponent(downloadURL);
Expand All @@ -182,7 +191,7 @@ var parseScript = function (aScriptData) {
script.showMinficationNotices = true;
}

if (!rAlternateDownload.test(downloadURL)) {
if (!skipAlternateDownloadValidation && !rAlternateDownload.test(downloadURL)) {
script.hasAlternateDownloadURL = true;
script.showMinficationNotices = true;
}
Expand Down

0 comments on commit 9e69db7

Please sign in to comment.