diff --git a/src/domain/session/room/timeline/deserialize.js b/src/domain/session/room/timeline/deserialize.js index c02c4117..4dbb1109 100644 --- a/src/domain/session/room/timeline/deserialize.js +++ b/src/domain/session/room/timeline/deserialize.js @@ -22,10 +22,13 @@ class Deserializer { } parseLink(node, children) { - // TODO Not equivalent to `node.href`! - // Add another HTMLParseResult method? const href = this.result.getAttributeValue(node, "href"); - const pillData = href && parsePillLink(href); + if (!href || !href.match(/^[a-z]+:[\/]{2}/i)) { + // Invalid or missing URLs are not turned into links + // We throw away relative links, too. + return new FormatPart("span", children); + } + const pillData = parsePillLink(href); if (pillData && pillData.userId) { return new PillPart(pillData.userId, href, children); }