File tree Expand file tree Collapse file tree 2 files changed +18
-6
lines changed
Expand file tree Collapse file tree 2 files changed +18
-6
lines changed Original file line number Diff line number Diff line change @@ -84,17 +84,25 @@ if [[ -n "$RANGE" && ( -n "$START_TIME" || -n "$END_TIME" ) ]]; then
8484fi
8585
8686if [[ -n " $RANGE " ]]; then
87- START_TIME=$( range_to_rfc3339 " $RANGE " )
88- END_TIME=$( date -u +%Y-%m-%dT%H:%M:%SZ)
87+ START_TIME=$( range_to_rfc3339 " $RANGE " ) || exit 1
88+ END_TIME=$( date -u +%Y-%m-%dT%H:%M:%SZ) || exit 1
89+ if [[ -z " $START_TIME " || -z " $END_TIME " ]]; then
90+ echo " Error: Failed to compute time range from '$RANGE '." >&2
91+ exit 1
92+ fi
8993elif [[ -n " $START_TIME " && -n " $END_TIME " ]]; then
9094 : # explicit start/end provided
9195elif [[ -n " $START_TIME " || -n " $END_TIME " ]]; then
9296 echo " Error: Both --start and --end are required when specifying explicit times." >&2
9397 exit 1
9498else
9599 # Default to 1h
96- START_TIME=$( range_to_rfc3339 " 1h" )
97- END_TIME=$( date -u +%Y-%m-%dT%H:%M:%SZ)
100+ START_TIME=$( range_to_rfc3339 " 1h" ) || exit 1
101+ END_TIME=$( date -u +%Y-%m-%dT%H:%M:%SZ) || exit 1
102+ if [[ -z " $START_TIME " || -z " $END_TIME " ]]; then
103+ echo " Error: Failed to compute default time range." >&2
104+ exit 1
105+ fi
98106fi
99107
100108# URL-encode a path segment
Original file line number Diff line number Diff line change @@ -116,8 +116,12 @@ if [[ -n "$RANGE" && ( -n "$START_TIME" || -n "$END_TIME" ) ]]; then
116116fi
117117
118118if [[ -n " $RANGE " ]]; then
119- START_TIME=$( range_to_rfc3339 " $RANGE " )
120- END_TIME=$( date -u +%Y-%m-%dT%H:%M:%SZ)
119+ START_TIME=$( range_to_rfc3339 " $RANGE " ) || exit 1
120+ END_TIME=$( date -u +%Y-%m-%dT%H:%M:%SZ) || exit 1
121+ if [[ -z " $START_TIME " || -z " $END_TIME " ]]; then
122+ echo " Error: Failed to compute time range from '$RANGE '." >&2
123+ exit 1
124+ fi
121125elif [[ -z " $START_TIME " || -z " $END_TIME " ]]; then
122126 echo " Error: Either (--start + --end) or --range is required." >&2
123127 exit 1
You can’t perform that action at this time.
0 commit comments