We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent dd0ed9e commit 09b0ad4Copy full SHA for 09b0ad4
apps/nuxt/src/tools/marked.ts
@@ -32,9 +32,14 @@ export class Marked {
32
}
33
34
public static isLocalLink(token: Tokens.Link): boolean {
35
- if (URL.canParse(token.href)) {
+ if (!token.href) {
36
+ return false
37
+ }
38
+
39
+ const url = this._getUrl(token)
40
41
+ if (url) {
42
const config = useRuntimeConfig()
- const url = new URL(token.href)
43
44
return (
45
[config.public.siteUrl, 'https://preprod.mission-transition-ecologique.incubateur.net', 'http://localhost:4242'].includes(
@@ -45,4 +50,12 @@ export class Marked {
50
46
51
return token.href.startsWith('/')
47
52
53
54
+ private static _getUrl(token: Tokens.Link) {
55
+ try {
56
+ return new URL(token.href)
57
+ } catch (e) {
58
+ return undefined
59
60
48
61
0 commit comments