From b4b5771e62fa1404fc04d1cb1f5c15558dee41d4 Mon Sep 17 00:00:00 2001 From: "Alex Pooley (@zuedev)" Date: Thu, 5 Feb 2026 16:20:33 +0000 Subject: only strip // comments at line start to avoid breaking URLs --- validators/bash/validate.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'validators/bash') diff --git a/validators/bash/validate.sh b/validators/bash/validate.sh index dddb811..f5ed86e 100644 --- a/validators/bash/validate.sh +++ b/validators/bash/validate.sh @@ -25,9 +25,11 @@ fi # Strip JSONC comments using sed strip_comments() { - # Remove carriage returns, single-line comments, multi-line comments, and trailing commas + # Remove carriage returns, single-line comments (only at start of line), + # multi-line comments, and trailing commas + # Note: only strips // comments at line start to avoid breaking URLs like https:// tr -d '\r' < "$1" \ - | sed 's|//.*||g' \ + | sed 's|^[[:space:]]*//.*||g' \ | sed 's|/\*[^*]*\*/||g' \ | sed 's/,[[:space:]]*}/}/g' \ | sed 's/,[[:space:]]*]/]/g' -- cgit v1.2.3