From 0bbf8f49147950e0e7c0d7a870f711120f19be9c Mon Sep 17 00:00:00 2001 From: the-djmaze <> Date: Wed, 21 Sep 2022 09:52:30 +0200 Subject: [PATCH] Added plain message `tel` uri detection --- dev/Model/Message.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/dev/Model/Message.js b/dev/Model/Message.js index b9759d155..555911f45 100644 --- a/dev/Model/Message.js +++ b/dev/Model/Message.js @@ -22,10 +22,11 @@ import PreviewHTML from 'Html/PreviewMessage.html'; import Remote from 'Remote/User/Fetch'; const - // eslint-disable-next-line max-len url = /(^|[\s\n]|\/?>)(https:\/\/[-A-Z0-9+\u0026\u2019#/%?=()~_|!:,.;]*[-A-Z0-9+\u0026#/%=~()_|])/gi, // eslint-disable-next-line max-len email = /(^|[\s\n]|\/?>)((?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|"(?:[\x21\x23-\x5b\x5d-\x7f]|\\[\x21\x23-\x5b\x5d-\x7f])*")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\[(?:(?:(2(5[0-5]|[0-4][0-9])|1[0-9][0-9]|[1-9]?[0-9]))\.){3}(?:(2(5[0-5]|[0-4][0-9])|1[0-9][0-9]|[1-9]?[0-9])|[a-z0-9-]*[a-z0-9]:(?:[\x21-\x5a\x53-\x7f]|\\[\x21\x23-\x5b\x5d-\x7f])+)\]))/gi, + // rfc3966 + tel = /(^|[\s\n]|\/?>)(tel:(\+[0-9().-]+|[0-9*#().-]+(;phone-context=\+[0-9+().-]+)?))/g, hcont = Element.fromHTML('
'), getRealHeight = el => { @@ -483,7 +484,8 @@ export class MessageModel extends AbstractModel { .trim() ) .replace(url, '$1$2') - .replace(email, '$1$2'); + .replace(email, '$1$2') + .replace(tel, '$1$2'); this.isHtml(false); this.hasImages(false); this.initView();