3
0
Fork 0
mirror of https://github.com/ZeppelinBot/Zeppelin.git synced 2025-03-15 05:41:51 +00:00

Allow getUrlsInString() to match urls that start mid-word with a protocol

This commit is contained in:
Dragory 2020-04-23 18:57:31 +03:00
parent ee3978797b
commit 4cf8c2ae92
No known key found for this signature in database
GPG key ID: 5F387BA66DF8AAC1

View file

@ -387,7 +387,10 @@ export async function findRelevantAuditLogEntry(
}
}
const urlRegex = /(\S+\.\S+)/g;
const realLinkRegex = /https?:\/\/\S+/; // http://anything or https://anything
const plainLinkRegex = /((?!https?:\/\/)\S)+\.\S+/; // anything.anything, without http:// or https:// preceding it
// Both of the above, with precedence on the first one
const urlRegex = new RegExp(`(${realLinkRegex.source}|${plainLinkRegex.source})`, "g");
const protocolRegex = /^[a-z]+:\/\//;
interface MatchedURL extends url.URL {