diff --git a/js/privatebin.js b/js/privatebin.js index e63ab5fb..930a1315 100644 --- a/js/privatebin.js +++ b/js/privatebin.js @@ -2119,7 +2119,11 @@ jQuery.PrivateBin = (function($, RawDeflate) { if (typeof response === 'string' && response.length > 0) { const shortUrlMatcher = /https?:\/\/[^\s]+/g; const shortUrl = (response.match(shortUrlMatcher) || []).filter(function(a) { - return URL.canParse(a); + try { + return !!new URL(a); + } catch (error) { + return false; + } }).sort(function(a, b) { return a.length - b.length; })[0]; diff --git a/js/test/PasteStatus.js b/js/test/PasteStatus.js index 9a5c60d0..baa6ab33 100644 --- a/js/test/PasteStatus.js +++ b/js/test/PasteStatus.js @@ -56,13 +56,6 @@ describe('PasteStatus', function () { ('#' + encodeURI(fragment)) : ''), clean = jsdom(); - // not available in node before v19.9.0, v18.17.0 - if (typeof URL.canParse !== 'function') { - URL.canParse = function(a) { - return true; - } - } - $('body').html('
'); $.PrivateBin.PasteStatus.init(); $.PrivateBin.PasteStatus.createPasteNotification('', ''); diff --git a/tpl/bootstrap.php b/tpl/bootstrap.php index 3c72c00b..927891ac 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 c66c2ee5..ba08d2ef 100644 --- a/tpl/page.php +++ b/tpl/page.php @@ -51,7 +51,7 @@ endif; ?> - +