mirror of
https://github.com/PrivateBin/PrivateBin.git
synced 2025-05-02 14:36:08 -04:00
Merge branch 'master' into ask-before-burn
This commit is contained in:
commit
03d2291ec7
10 changed files with 272 additions and 210 deletions
|
@ -2128,7 +2128,7 @@ jQuery.PrivateBin = (function($, RawDeflate) {
|
|||
response = JSON.stringify(response);
|
||||
}
|
||||
if (typeof response === 'string' && response.length > 0) {
|
||||
const shortUrlMatcher = /https?:\/\/[^\s]+/g;
|
||||
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);
|
||||
|
@ -2140,7 +2140,7 @@ jQuery.PrivateBin = (function($, RawDeflate) {
|
|||
return false;
|
||||
}
|
||||
}).sort(function(a, b) {
|
||||
return a.length - b.length;
|
||||
return a.length - b.length; // shortest first
|
||||
})[0];
|
||||
if (typeof shortUrl === 'string' && shortUrl.length > 0) {
|
||||
// we disable the button to avoid calling shortener again
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue