This commit is contained in:
parent
8f1487d0f4
commit
a26963e68a
1 changed files with 2 additions and 2 deletions
|
|
@ -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"
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue