mirror of
https://github.com/PrivateBin/PrivateBin.git
synced 2025-10-03 17:49:19 +02:00
fix regex check for short url in response
This commit is contained in:
parent
952e86b11c
commit
191ed63b04
3 changed files with 3 additions and 2 deletions
|
@ -2151,7 +2151,7 @@ jQuery.PrivateBin = (function($) {
|
|||
response = JSON.stringify(response);
|
||||
}
|
||||
if (typeof response === 'string' && response.length > 0) {
|
||||
const shortUrlMatcher = /https?:\/\/[^\s"<]+/g; // JSON API will have URL in quotes, XML in tags
|
||||
const shortUrlMatcher = /(?<=[>"])https?:\/\/[^\s"<]+(?=[<"])/g; // JSON API will have URL in quotes, XML in tags
|
||||
const shortUrl = (response.match(shortUrlMatcher) || []).filter(function(urlRegExMatch) {
|
||||
if (typeof URL.canParse === 'function') {
|
||||
return URL.canParse(urlRegExMatch);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue