Properly handle errors from URL constructor
This commit is contained in:
@@ -69,8 +69,13 @@ export class OscLinkProvider implements ILinkProvider {
|
|||||||
|
|
||||||
let ignoreLink = false;
|
let ignoreLink = false;
|
||||||
if (!linkHandler?.allowNonHttpProtocols) {
|
if (!linkHandler?.allowNonHttpProtocols) {
|
||||||
const parsed = new URL(text);
|
try {
|
||||||
if (!['http:', 'https:'].includes(parsed.protocol)) {
|
const parsed = new URL(text);
|
||||||
|
if (!['http:', 'https:'].includes(parsed.protocol)) {
|
||||||
|
ignoreLink = true;
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
// Ignore invalid URLs to prevent unexpected behaviors
|
||||||
ignoreLink = true;
|
ignoreLink = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user