|
|
@@ -2041,8 +2041,8 @@ jQuery.PrivateBin = (function($, RawDeflate) {
|
|
|
responseString = JSON.stringify(responseString);
|
|
|
}
|
|
|
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 shortUrlMatcher = /https?:\/\/[^\s]+/g;
|
|
|
+ const shortUrl = (responseString.match(shortUrlMatcher) || []).filter(URL.canParse).sort(function(a, b) {
|
|
|
return a.length - b.length;
|
|
|
})[0];
|
|
|
if (typeof shortUrl === 'string' && shortUrl.length > 0) {
|