Fixes #2718: Message is not displayed if it contains an invalid URL

This commit is contained in:
JC Brand 2021-11-24 21:43:20 +01:00
parent e4da0f894d
commit ee4e056125
2 changed files with 10 additions and 2 deletions

View File

@ -14,6 +14,7 @@
- #2423: Could not find dependency "converse-controlbox" for plugin "converse-muc"
- #2647: Singleton mode doesn't work
- #2704: Send button doesn't work in a multi-user chat
- #2718: Message is not displayed if it contains an invalid URL
- #2725: Send new presence status to all connected MUCs
- #2728: Not sending headers with upload request
- #2733: OMEMO Messages received while client closed not decrypted

View File

@ -1,5 +1,6 @@
import { html } from "lit";
import log from '@converse/headless/log';
import { api } from "@converse/headless/core";
import { html } from "lit";
function onClickXMPPURI (ev) {
ev.preventDefault();
@ -7,7 +8,13 @@ function onClickXMPPURI (ev) {
}
export default (uri, url_text) => {
let normalized_url = uri.normalize()._string;
let normalized_url;
try {
normalized_url = uri.normalize()._string;
} catch (e) {
log.error(e);
return url_text;
}
const pretty_url = uri._parts.urn ? normalized_url : uri.readable();
const visible_url = url_text || pretty_url;
if (!uri._parts.protocol && !normalized_url.startsWith('http://') && !normalized_url.startsWith('https://')) {