Link: Use HTTPS as default prefix (#3736)
This commit is contained in:
parent
c7db27482d
commit
493e62b5c2
@ -1,7 +1,5 @@
|
||||
const PROTOCOL_WHITELIST = new Set(['http:', 'https:', 'tg:', 'ton:', 'mailto:', 'tel:']);
|
||||
// HTTP was chosen by default as a fix for https://bugs.telegram.org/c/10712.
|
||||
// It is also the default protocol in the official TDesktop client.
|
||||
const FALLBACK_PREFIX = 'http://';
|
||||
const FALLBACK_PREFIX = 'https://';
|
||||
|
||||
export function ensureProtocol(url?: string) {
|
||||
if (!url) {
|
||||
|
||||
@ -135,7 +135,7 @@ function parseMarkdown(html: string) {
|
||||
|
||||
function parseMarkdownLinks(html: string) {
|
||||
return html.replace(new RegExp(`\\[([^\\]]+?)]\\((${RE_LINK_TEMPLATE}+?)\\)`, 'g'), (_, text, link) => {
|
||||
const url = link.includes('://') ? link : link.includes('@') ? `mailto:${link}` : `http://${link}`;
|
||||
const url = link.includes('://') ? link : link.includes('@') ? `mailto:${link}` : `https://${link}`;
|
||||
return `<a href="${url}">${text}</a>`;
|
||||
});
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user