mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-03-15 05:41:51 +00:00
automod match_link fixes (#432)
* remove trailing dot from FQDN for TLD check Signed-off-by: GitHub <noreply@github.com> * yeet all trailing characters from TLDs Signed-off-by: GitHub <noreply@github.com> * oops Signed-off-by: GitHub <noreply@github.com> * move dumb loop to regex replace Signed-off-by: GitHub <noreply@github.com> --------- Signed-off-by: GitHub <noreply@github.com> Co-authored-by: Almeida <github@almeidx.dev>
This commit is contained in:
parent
d09e0566b3
commit
7c946949d6
1 changed files with 7 additions and 1 deletions
|
@ -647,7 +647,13 @@ export function getUrlsInString(str: string, onlyUnique = false): MatchedURL[] {
|
||||||
return urls;
|
return urls;
|
||||||
}
|
}
|
||||||
|
|
||||||
const hostnameParts = matchUrl.hostname.split(".");
|
let hostname = matchUrl.hostname.toLowerCase();
|
||||||
|
|
||||||
|
if (hostname.length > 3) {
|
||||||
|
hostname = hostname.replace(/[^a-z]+$/, "");
|
||||||
|
}
|
||||||
|
|
||||||
|
const hostnameParts = hostname.split(".");
|
||||||
const tld = hostnameParts[hostnameParts.length - 1];
|
const tld = hostnameParts[hostnameParts.length - 1];
|
||||||
if (tlds.includes(tld)) {
|
if (tlds.includes(tld)) {
|
||||||
urls.push(matchUrl);
|
urls.push(matchUrl);
|
||||||
|
|
Loading…
Add table
Reference in a new issue