From 49240a57e063844387831336908111c0229f5ec0 Mon Sep 17 00:00:00 2001 From: "(quasar) nebula" Date: Fri, 1 Mar 2024 08:13:59 -0400 Subject: data-checks: reportContentTextErrors: report invalid external URLs --- src/data/checks.js | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/data') diff --git a/src/data/checks.js b/src/data/checks.js index 79a8d4c9..d42146d4 100644 --- a/src/data/checks.js +++ b/src/data/checks.js @@ -574,6 +574,16 @@ export function reportContentTextErrors(wikiData, { continue; } } + } else if (node.type === 'external-link') { + try { + new URL(node.data.href); + } catch (error) { + yield { + index, length, + message: + `Invalid URL ${colors.red(`"${node.data.href}"`)}`, + }; + } } } } -- cgit 1.3.0-6-gf8a5