Skip to content

Commit b4b5771

Browse files
committed
only strip // comments at line start to avoid breaking URLs
1 parent 889d195 commit b4b5771

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

validators/bash/validate.sh

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,11 @@ fi
2525

2626
# Strip JSONC comments using sed
2727
strip_comments() {
28-
# Remove carriage returns, single-line comments, multi-line comments, and trailing commas
28+
# Remove carriage returns, single-line comments (only at start of line),
29+
# multi-line comments, and trailing commas
30+
# Note: only strips // comments at line start to avoid breaking URLs like https://
2931
tr -d '\r' < "$1" \
30-
| sed 's|//.*||g' \
32+
| sed 's|^[[:space:]]*//.*||g' \
3133
| sed 's|/\*[^*]*\*/||g' \
3234
| sed 's/,[[:space:]]*}/}/g' \
3335
| sed 's/,[[:space:]]*]/]/g'

0 commit comments

Comments
 (0)