linkify: update and do not add un-necessary http scheme

Change-Id: I7bd12dbc3bf512b3cd880892d2afda17c8117bd6
GitLab: #862
This commit is contained in:
Sébastien Blin
2022-12-23 16:22:52 -05:00
parent b92119b4b8
commit cd5bdbb211
3 changed files with 3407 additions and 1194 deletions

View File

@@ -10,8 +10,9 @@ function getPreviewInfo(messageId, url) {
var title = null
var description = null
var image = null
if (!url.includes("http://") && !url.includes("https://")) {
url = "http://".concat(url)
var u = new URL(url)
if (u.protocol === '') {
url = "https://".concat(url)
}
var domain = (new URL(url))
fetch(url, {