sforkowany z mirror/friendica
Merge pull request #7587 from MrPetovan/bug/7576-linkpreview-lookbehind
Remove unevenly supported lookbehind from link preview regular expression2022.09-rc
commit
0cdf094f86
|
@ -52,7 +52,7 @@
|
||||||
<div class="clear"></div>\
|
<div class="clear"></div>\
|
||||||
<hr class="previewseparator">';
|
<hr class="previewseparator">';
|
||||||
var text;
|
var text;
|
||||||
var urlRegex = /(?<!=)(https?\:\/\/|\s)[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,4})(\/+[a-z0-9_.\:\;-]*)*(\?[\&\%\|\+a-z0-9_=,\.\:\;-]*)?([\&\%\|\+&a-z0-9_=,\:\;\.-]*)([\!\#\/\&\%\|\+a-z0-9_=,\:\;\.-]*)}*/i;
|
var urlRegex = /^(?:https?\:\/\/|\s)[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,4})(?:\/+[a-z0-9_.\:\;-]*)*(?:\?[\&\%\|\+a-z0-9_=,\.\:\;-]*)?(?:[\&\%\|\+&a-z0-9_=,\:\;\.-]*)(?:[\!\#\/\&\%\|\+a-z0-9_=,\:\;\.-]*)}*$/i;
|
||||||
var binurl;
|
var binurl;
|
||||||
var block = false;
|
var block = false;
|
||||||
var blockTitle = false;
|
var blockTitle = false;
|
||||||
|
@ -133,8 +133,7 @@
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (trim(text) !== "") {
|
if (trim(text) !== "" && block === false && urlRegex.test(text)) {
|
||||||
if (block === false && urlRegex.test(text)) {
|
|
||||||
binurl = bin2hex(text);
|
binurl = bin2hex(text);
|
||||||
block = true;
|
block = true;
|
||||||
|
|
||||||
|
@ -148,7 +147,6 @@
|
||||||
getContentData(binurl, processContentData);
|
getContentData(binurl, processContentData);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Ładowanie…
Reference in New Issue