|
@@ -81,7 +81,7 @@ describe('Helper', function () {
|
|
|
'ignores non-URL content',
|
|
'ignores non-URL content',
|
|
|
'string',
|
|
'string',
|
|
|
function (content) {
|
|
function (content) {
|
|
|
- return content === $.PrivateBin.Helper.urls2links(content);
|
|
|
|
|
|
|
+ return $.PrivateBin.Helper.htmlEntities(content) === $.PrivateBin.Helper.urls2links(content);
|
|
|
}
|
|
}
|
|
|
);
|
|
);
|
|
|
jsc.property(
|
|
jsc.property(
|
|
@@ -95,8 +95,7 @@ describe('Helper', function () {
|
|
|
function (prefix, schema, address, query, fragment, postfix) {
|
|
function (prefix, schema, address, query, fragment, postfix) {
|
|
|
query = query.join('');
|
|
query = query.join('');
|
|
|
fragment = fragment.join('');
|
|
fragment = fragment.join('');
|
|
|
- prefix = $.PrivateBin.Helper.htmlEntities(prefix);
|
|
|
|
|
- postfix = ' ' + $.PrivateBin.Helper.htmlEntities(postfix);
|
|
|
|
|
|
|
+ postfix = ' ' + postfix;
|
|
|
let url = schema + '://' + address.join('') + '/?' + query + '#' + fragment;
|
|
let url = schema + '://' + address.join('') + '/?' + query + '#' + fragment;
|
|
|
|
|
|
|
|
// special cases: When the query string and fragment imply the beginning of an HTML entity, eg. � or &#x
|
|
// special cases: When the query string and fragment imply the beginning of an HTML entity, eg. � or &#x
|
|
@@ -109,7 +108,7 @@ describe('Helper', function () {
|
|
|
postfix = '';
|
|
postfix = '';
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- return prefix + '<a href="' + url + '" rel="nofollow">' + url + '</a>' + postfix === $.PrivateBin.Helper.urls2links(prefix + url + postfix);
|
|
|
|
|
|
|
+ return $.PrivateBin.Helper.htmlEntities(prefix) + '<a href="' + url + '" rel="nofollow">' + $.PrivateBin.Helper.htmlEntities(url) + '</a>' + $.PrivateBin.Helper.htmlEntities(postfix) === $.PrivateBin.Helper.urls2links(prefix + url + postfix);
|
|
|
}
|
|
}
|
|
|
);
|
|
);
|
|
|
jsc.property(
|
|
jsc.property(
|
|
@@ -118,10 +117,8 @@ describe('Helper', function () {
|
|
|
jsc.array(common.jscQueryString()),
|
|
jsc.array(common.jscQueryString()),
|
|
|
'string',
|
|
'string',
|
|
|
function (prefix, query, postfix) {
|
|
function (prefix, query, postfix) {
|
|
|
- prefix = $.PrivateBin.Helper.htmlEntities(prefix);
|
|
|
|
|
- postfix = $.PrivateBin.Helper.htmlEntities(postfix);
|
|
|
|
|
let url = 'magnet:?' + query.join('').replace(/^&+|&+$/gm,'');
|
|
let url = 'magnet:?' + query.join('').replace(/^&+|&+$/gm,'');
|
|
|
- return prefix + '<a href="' + url + '" rel="nofollow">' + url + '</a> ' + postfix === $.PrivateBin.Helper.urls2links(prefix + url + ' ' + postfix);
|
|
|
|
|
|
|
+ return $.PrivateBin.Helper.htmlEntities(prefix) + '<a href="' + url + '" rel="nofollow">' + $.PrivateBin.Helper.htmlEntities(url) + '</a> ' + $.PrivateBin.Helper.htmlEntities(postfix) === $.PrivateBin.Helper.urls2links(prefix + url + ' ' + postfix);
|
|
|
}
|
|
}
|
|
|
);
|
|
);
|
|
|
});
|
|
});
|