fix regex check for short url in response

This commit is contained in:
Karthik Kasturi 2025-09-10 16:02:06 +01:00
parent 952e86b11c
commit 191ed63b04
3 changed files with 3 additions and 2 deletions

View file

@ -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);