Skip to content
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

Bypass notices on certain unicode strings. #891

Merged
merged 1 commit into from
Feb 5, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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