Links: Ignore capitalization for t.me links (#2495)
This commit is contained in:
parent
422e13262f
commit
16efb72773
@ -217,9 +217,9 @@ export const CONTENT_NOT_SUPPORTED = 'The message is not supported on this versi
|
||||
// eslint-disable-next-line max-len
|
||||
export const RE_LINK_TEMPLATE = '((ftp|https?):\\/\\/)?((www\\.)?[-a-zA-Z0-9@:%._+~#=]{1,256}\\.[a-zA-Z0-9()]{1,63})\\b([-a-zA-Z0-9()@:%_+.~#?&/=]*)';
|
||||
export const RE_MENTION_TEMPLATE = '(@[\\w\\d_-]+)';
|
||||
export const RE_TG_LINK = /^tg:(\/\/)?/;
|
||||
export const RE_TME_LINK = /^(https?:\/\/)?([-a-zA-Z0-9@:%_+~#=]{1,32}\.)?t\.me/;
|
||||
export const RE_TELEGRAM_LINK = /^(https?:\/\/)?telegram\.org\//;
|
||||
export const RE_TG_LINK = /^tg:(\/\/)?/i;
|
||||
export const RE_TME_LINK = /^(https?:\/\/)?([-a-zA-Z0-9@:%_+~#=]{1,32}\.)?t\.me/i;
|
||||
export const RE_TELEGRAM_LINK = /^(https?:\/\/)?telegram\.org\//i;
|
||||
export const TME_LINK_PREFIX = 'https://t.me/';
|
||||
export const USERNAME_PURCHASE_ERROR = 'USERNAME_PURCHASE_AVAILABLE';
|
||||
export const PURCHASE_USERNAME = 'auction';
|
||||
|
||||
@ -868,7 +868,7 @@ addActionHandler('openTelegramLink', (global, actions, payload): ActionReturnTyp
|
||||
return;
|
||||
}
|
||||
|
||||
const uri = new URL(url.startsWith('http') ? url : `https://${url}`);
|
||||
const uri = new URL(url.toLowerCase().startsWith('http') ? url : `https://${url}`);
|
||||
if (TME_WEB_DOMAINS.has(uri.hostname) && uri.pathname === '/') {
|
||||
window.open(uri.toString(), '_blank', 'noopener');
|
||||
return;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user