Skip to content

Commit 85a3efa

Browse files
committed
refactor: check TUSURL strictly
1 parent fe16658 commit 85a3efa

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

tusc.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ CHKSUM="$SUMALGO $(echo -n $KEY | base64 -w 0)"
207207
# head request
208208
TUSURL=`tus-config ".[\"$KEY\"].location?"`
209209
[[ $LOCATE ]] && info "URL: $TUSURL" && [[ $TUSURL != "null" ]]; [[ $LOCATE ]] && exit $?
210-
[[ "null" != "$TUSURL" ]] && request "--head $TUSURL"
210+
[[ $TUSURL ]] && [[ "null" != "$TUSURL" ]] && request "--head $TUSURL"
211211
212212
if [[ "null" != "$TUSURL" ]] && [[ $ISOK -eq 1 ]]; then
213213
OFFSET=${HEADERS[Upload-Offset]} LEFTOVER=$((SIZE - OFFSET))
@@ -227,6 +227,7 @@ else
227227
-X POST $HOST${BASEPATH:-/files/}"
228228
229229
TUSURL=${HEADERS[Location]}
230+
[[ $TUSURL ]] || error "Tus server replied with empty location. Try changing --base-path param." 1
230231
231232
# save location config
232233
tus-config ".[\"$KEY\"].location" "$TUSURL"

0 commit comments

Comments
 (0)