We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent f08c9d7 commit 9c5c61cCopy full SHA for 9c5c61c
1 file changed
validators/bash/validate.sh
@@ -27,7 +27,8 @@ fi
27
strip_comments() {
28
# Remove carriage returns (Windows line endings), single-line comments, and multi-line comments
29
# Also remove trailing commas before } or ] (valid in JSONC, invalid in JSON)
30
- cat "$1" | tr -d '\r' | sed -e 's|//.*$||g' -e ':a;s|/\*.*\*/||g;ta' -e '/\/\*/,/\*\//d' | sed -e 's/,\s*}/}/g' -e 's/,\s*]/]/g'
+ # Uses POSIX-compatible sed syntax for portability (works with busybox sed)
31
+ cat "$1" | tr -d '\r' | sed 's|//.*$||g' | sed 's|/\*[^*]*\*/||g' | sed 's/,[ ]*}/}/g' | sed 's/,[ ]*]/]/g'
32
}
33
34
# Validate URI format
0 commit comments