From: Charlie Fish Date: Fri, 30 Jul 2021 04:03:21 +0000 (-0600) Subject: Adding lint rule to disallow whitespace in urls X-Git-Tag: aggregated-20250518~419^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F434%2Fhead;p=thirdparty%2Fblocklistproject%2Flists.git Adding lint rule to disallow whitespace in urls --- diff --git a/scripts/lint.js b/scripts/lint.js index b72d219..91b1855 100644 --- a/scripts/lint.js +++ b/scripts/lint.js @@ -59,6 +59,16 @@ const path = require("path"); hasError = true; } } + + // Ensure that the URL doesn't contain whitespace characters + if (line.startsWith("0.0.0.0 ")) { + const lineNoIP = line.replace("0.0.0.0 ", ""); + const url = lineNoIP.split("#")[0].trim(); + if (/\s/gmu.test(url)) { + console.error(`Line ${index + 1} in ${file} url ${url} contains whitespace in the URL.`); + hasError = true; + } + } }); }));