mirror of
https://github.com/PrivateBin/PrivateBin.git
synced 2025-05-02 14:36:08 -04:00
use the newer function, if possible
This commit is contained in:
parent
c3331070cb
commit
ba17e94c5e
3 changed files with 6 additions and 2 deletions
|
@ -2119,6 +2119,10 @@ jQuery.PrivateBin = (function($, RawDeflate) {
|
|||
if (typeof response === 'string' && response.length > 0) {
|
||||
const shortUrlMatcher = /https?:\/\/[^\s]+/g;
|
||||
const shortUrl = (response.match(shortUrlMatcher) || []).filter(function(urlRegExMatch) {
|
||||
if (typeof URL.canParse === 'function') {
|
||||
return URL.canParse(urlRegExMatch);
|
||||
}
|
||||
// polyfill for older browsers (< 120) & node (< 19.9 & < 18.17)
|
||||
try {
|
||||
return !!new URL(urlRegExMatch);
|
||||
} catch (error) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue