mirror of
https://github.com/PrivateBin/PrivateBin.git
synced 2024-03-22 13:10:41 +08:00
Fix an edge case where we cannot find any shortUrl
This commit is contained in:
parent
a5cd8696e6
commit
1af7b536a5
|
@ -1730,7 +1730,7 @@ jQuery.PrivateBin = (function($, RawDeflate) {
|
|||
}
|
||||
if (typeof responseString === 'string' && responseString.length > 0) {
|
||||
const shortUrlMatcher = /https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_\+.~#?&//=]*)/g;
|
||||
const shortUrl = responseString.match(shortUrlMatcher).sort(function(a, b) {
|
||||
const shortUrl = (responseString.match(shortUrlMatcher) || []).sort(function(a, b) {
|
||||
return a.length - b.length;
|
||||
})[0];
|
||||
if (typeof shortUrl === 'string' && shortUrl.length > 0) {
|
||||
|
|
Loading…
Reference in New Issue
Block a user