diff --git a/js/common.js b/js/common.js
index e4884d5..d1808a0 100644
--- a/js/common.js
+++ b/js/common.js
@@ -26,6 +26,7 @@ var a2zString = ['a','b','c','d','e','f','g','h','i','j','k','l','m',
'n','o','p','q','r','s','t','u','v','w','x','y','z'],
alnumString = a2zString.concat(['0','1','2','3','4','5','6','7','8','9']),
queryString = alnumString.concat(['+','%','&','.','*','-','_']),
+ hashString = queryString.concat(['!']),
base64String = alnumString.concat(['+','/','=']).concat(
a2zString.map(function(c) {
return c.toUpperCase();
@@ -127,6 +128,11 @@ exports.jscQueryString = function() {
return jsc.elements(queryString);
};
+// provides random characters allowed in hash queries
+exports.jscHashString = function() {
+ return jsc.elements(hashString);
+};
+
// provides random characters allowed in base64 encoded strings
exports.jscBase64String = function() {
return jsc.elements(base64String);
diff --git a/js/privatebin.js b/js/privatebin.js
index a108273..0e30974 100644
--- a/js/privatebin.js
+++ b/js/privatebin.js
@@ -146,9 +146,8 @@ jQuery.PrivateBin = (function($, sjcl, Base64, RawDeflate) {
*/
me.urls2links = function(html)
{
- // URL part of RegEx: https://regex101.com/r/h4ACei/5
return html.replace(
- /(((https?|ftp):\/\/(([a-z0-9$_\.\+!\*\'\(\),;\?&=-]|%[0-9a-f]{2})+(:([a-z0-9$_\.\+!\*\'\(\),;\?&=-]|%[0-9a-f]{2})+)?@)?((([a-z0-9]\.|[a-z0-9][a-z0-9-]*[a-z0-9]\.)*[a-z][a-z0-9-]*[a-z0-9]?|((\d|[1-9]\d|1\d{2}|2[0-4][0-9]|25[0-5])\.){3}(\d|[1-9]\d|1\d{2}|2[0-4][0-9]|25[0-5]))(:\d+)?)(((\/+([a-z0-9$_\.\+!\*\'\(\),;:@&=-]|%[0-9a-f]{2})*)*(\?([a-z0-9$_\.\+!\*\'\(\),;:@&=-]|%[0-9a-f]{2})*)?)?)?(#([a-z0-9$_\.\+!\*\'\(\),;:@&=-]|%[0-9a-f]{2})*)?|((magnet):[\w?=&.\/-;#@~%+*-]+)))/ig,
+ /(((https?|ftp):\/\/[\w?!=&.\/-;#@~%+*-]+(?![\w\s?!&.\/;#~%"=-]*>))|((magnet):[\w?=&.\/-;#@~%+*-]+))/ig,
'$1'
);
};
diff --git a/js/test/Helper.js b/js/test/Helper.js
index e4141f5..f76bf4f 100644
--- a/js/test/Helper.js
+++ b/js/test/Helper.js
@@ -94,7 +94,7 @@ describe('Helper', function () {
jsc.elements(['http', 'https', 'ftp']),
jsc.nearray(common.jscA2zString()),
jsc.array(common.jscQueryString()),
- jsc.array(common.jscQueryString()),
+ jsc.array(common.jscHashString()),
'string',
function (prefix, schema, address, query, fragment, postfix) {
var query = query.join(''),
diff --git a/js/test/Model.js b/js/test/Model.js
index 8605476..18ec8a8 100644
--- a/js/test/Model.js
+++ b/js/test/Model.js
@@ -81,7 +81,7 @@ describe('Model', function () {
'returns the query string without separator, if any',
jsc.nearray(common.jscA2zString()),
jsc.nearray(common.jscA2zString()),
- jsc.nearray(common.jscQueryString()),
+ jsc.nearray(common.jscHashString()),
'string',
function (schema, address, query, fragment) {
var queryString = query.join(''),
@@ -145,7 +145,7 @@ describe('Model', function () {
jsc.nearray(common.jscA2zString()),
jsc.array(common.jscQueryString()),
jsc.nearray(common.jscBase64String()),
- jsc.array(common.jscQueryString()),
+ jsc.array(common.jscHashString()),
function (schema, address, query, fragment, trail) {
var fragmentString = fragment.join(''),
clean = jsdom('', {
diff --git a/tpl/bootstrap.php b/tpl/bootstrap.php
index 7f91f1b..d500fa7 100644
--- a/tpl/bootstrap.php
+++ b/tpl/bootstrap.php
@@ -75,7 +75,7 @@ if ($MARKDOWN):
-
+
diff --git a/tpl/page.php b/tpl/page.php
index f6e06bd..9b446d8 100644
--- a/tpl/page.php
+++ b/tpl/page.php
@@ -53,7 +53,7 @@ if ($MARKDOWN):
-
+