diff --git a/js/privatebin.js b/js/privatebin.js
index 9e2b0ee2..d2b85448 100644
--- a/js/privatebin.js
+++ b/js/privatebin.js
@@ -297,25 +297,10 @@ jQuery.PrivateBin = (function($, RawDeflate) {
*/
me.urls2links = function(html)
{
- let reverseEntityMap = {};
- for (let entity of ['&', '"', '/', '=']) {
- reverseEntityMap[entityMap[entity]] = entity;
- }
- const entityRegex = new RegExp(Object.keys(reverseEntityMap).join('|'), 'g');
-
- // encode HTML entities, find and insert links, partially decoding only the href property of it
- return me.htmlEntities(html)
- .replace(
- /(((https?|ftp)://[\w?!&.-;#@~%+*-]+(?![\w\s?!&.;#~%-]*>))|((magnet):[\w?&.-;#@~%+*-]+))/ig,
- function(encodedUrl) {
- let decodedUrl = encodedUrl.replace(
- entityRegex, function(entity) {
- return reverseEntityMap[entity];
- }
- );
- return '' + encodedUrl + '';
- }
- )
+ return html.replace(
+ /(((https?|ftp):\/\/[\w?!=&.\/-;#@~%+*-]+(?![\w\s?!&.\/;#~%"=-]*>))|((magnet):[\w?=&.\/-;#@~%+*-]+))/ig,
+ '$1'
+ );
};
/**
diff --git a/js/test/Helper.js b/js/test/Helper.js
index a884eee2..dd38e3c4 100644
--- a/js/test/Helper.js
+++ b/js/test/Helper.js
@@ -81,7 +81,7 @@ describe('Helper', function () {
'ignores non-URL content',
'string',
function (content) {
- return $.PrivateBin.Helper.htmlEntities(content) === $.PrivateBin.Helper.urls2links(content);
+ return content === $.PrivateBin.Helper.urls2links(content);
}
);
jsc.property(
@@ -95,7 +95,8 @@ describe('Helper', function () {
function (prefix, schema, address, query, fragment, postfix) {
query = query.join('');
fragment = fragment.join('');
- postfix = ' ' + postfix;
+ prefix = $.PrivateBin.Helper.htmlEntities(prefix);
+ postfix = ' ' + $.PrivateBin.Helper.htmlEntities(postfix);
let url = schema + '://' + address.join('') + '/?' + query + '#' + fragment;
// special cases: When the query string and fragment imply the beginning of an HTML entity, eg. or
@@ -108,7 +109,7 @@ describe('Helper', function () {
postfix = '';
}
- return $.PrivateBin.Helper.htmlEntities(prefix) + '' + $.PrivateBin.Helper.htmlEntities(url) + '' + $.PrivateBin.Helper.htmlEntities(postfix) === $.PrivateBin.Helper.urls2links(prefix + url + postfix);
+ return prefix + '' + url + '' + postfix === $.PrivateBin.Helper.urls2links(prefix + url + postfix);
}
);
jsc.property(
@@ -117,8 +118,10 @@ describe('Helper', function () {
jsc.array(common.jscQueryString()),
'string',
function (prefix, query, postfix) {
+ prefix = $.PrivateBin.Helper.htmlEntities(prefix);
+ postfix = $.PrivateBin.Helper.htmlEntities(postfix);
let url = 'magnet:?' + query.join('').replace(/^&+|&+$/gm,'');
- return $.PrivateBin.Helper.htmlEntities(prefix) + '' + $.PrivateBin.Helper.htmlEntities(url) + ' ' + $.PrivateBin.Helper.htmlEntities(postfix) === $.PrivateBin.Helper.urls2links(prefix + url + ' ' + postfix);
+ return prefix + '' + url + ' ' + postfix === $.PrivateBin.Helper.urls2links(prefix + url + ' ' + postfix);
}
);
});
diff --git a/tpl/bootstrap.php b/tpl/bootstrap.php
index ba47c27a..843dc6a7 100644
--- a/tpl/bootstrap.php
+++ b/tpl/bootstrap.php
@@ -72,7 +72,7 @@ endif;
?>
-
+
diff --git a/tpl/page.php b/tpl/page.php
index 9d66a861..c976ce2f 100644
--- a/tpl/page.php
+++ b/tpl/page.php
@@ -50,7 +50,7 @@ endif;
?>
-
+