diff --git a/js/privatebin.js b/js/privatebin.js
index c5ee7fb0..db85eef7 100644
--- a/js/privatebin.js
+++ b/js/privatebin.js
@@ -2041,8 +2041,8 @@ jQuery.PrivateBin = (function($, RawDeflate) {
responseString = JSON.stringify(responseString);
}
if (typeof responseString === 'string' && responseString.length > 0) {
- const shortUrlMatcher = /https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_\+.~#?&//=]*)/g;
- const shortUrl = (responseString.match(shortUrlMatcher) || []).sort(function(a, b) {
+ const shortUrlMatcher = /https?:\/\/[^\s]+/g;
+ const shortUrl = (responseString.match(shortUrlMatcher) || []).filter(URL.canParse).sort(function(a, b) {
return a.length - b.length;
})[0];
if (typeof shortUrl === 'string' && shortUrl.length > 0) {
diff --git a/tpl/bootstrap.php b/tpl/bootstrap.php
index a307c4e7..386705fa 100644
--- a/tpl/bootstrap.php
+++ b/tpl/bootstrap.php
@@ -73,7 +73,7 @@ endif;
?>
-
+
diff --git a/tpl/page.php b/tpl/page.php
index fa70097a..026b4ae1 100644
--- a/tpl/page.php
+++ b/tpl/page.php
@@ -51,7 +51,7 @@ endif;
?>
-
+