diff --git a/download.sh b/download.sh index f6dafeb..2557c7d 100755 --- a/download.sh +++ b/download.sh @@ -58,7 +58,7 @@ curl -s -L "$URL" -o "$TEMP_FILE" || { } # Get file extension based on MIME type -EXTENSION=$(get_file_extension "$TEMP_FILE") +EXTENSION=.json # Always construct filename from the URL, replacing slashes with hyphens FILENAME=$(echo "$URL" | sed -E 's|^https?://||' | sed -E 's|^www\.||' | sed 's|/$||' | sed 's|/|-|g') @@ -81,7 +81,7 @@ if [ "$EXTENSION" = ".json" ]; then PRETTY_TEMP=$(mktemp) # Try to pretty-print with jq, but don't fail if jq fails if command -v jq &> /dev/null; then - if jq . "$TEMP_FILE" > "$PRETTY_TEMP" 2>/dev/null; then + if jq '.warnings.warning |= sort_by(.id)' "$TEMP_FILE" > "$PRETTY_TEMP" 2>/dev/null; then mv "$PRETTY_TEMP" "$TEMP_FILE" else rm -f "$PRETTY_TEMP"