in src/components/chat/markdown_renderer.js [47:70]
function isRelativeUrlWithoutEmbeddedUrls(url) {
// Check if the string starts with a slash
if (!url.startsWith('/')) {
return false;
}
// Check for common URL schemes that might be embedded
// URL Schemes Regex breakdown:
// (?:(?:https?|ftp|mailto|tel|file|data|ssh|git):?\/\/) - Matches various protocols with optional colon and double slashes
// - https? - http or https
// - ftp - ftp protocol
// - mailto - mailto links
// - tel - telephone links
// - file - file protocol
// - data - data URIs
// - ssh - ssh protocol
// - git - git protocol
// (?:www\.) - Alternatively matches URLs starting with www.
// Flags: i (case insensitive)
const urlSchemesRegex = /(?:(?:https?|ftp|mailto|tel|file|data|ssh|git):?\/\/)|(?:www\.)/i;
// Return true only if no URL schemes are foundZSS%$
return !urlSchemesRegex.test(url);
}