mirror of
https://github.com/notwa/rc
synced 2024-05-18 09:53:22 -07:00
handle http errors properly in oxo
This commit is contained in:
parent
45f963657c
commit
927048ef33
4
sh/oxo
4
sh/oxo
|
@ -46,7 +46,7 @@ oxo() { ### @-
|
||||||
local f= s=
|
local f= s=
|
||||||
|
|
||||||
if [ $# -eq 0 ]; then
|
if [ $# -eq 0 ]; then
|
||||||
curl -F'file=@-' https://0x0.st && : $((hits+=1)) || true
|
curl -f -F'file=@-' https://0x0.st && : $((hits+=1)) || true
|
||||||
total=1
|
total=1
|
||||||
elif [ $# -gt 255 ]; then
|
elif [ $# -gt 255 ]; then
|
||||||
printf "$err" "oxo: too many arguments (max: 255)" >&2
|
printf "$err" "oxo: too many arguments (max: 255)" >&2
|
||||||
|
@ -92,7 +92,7 @@ oxo() { ### @-
|
||||||
local d=$(( b*c/8192+3*kib/16+1-32768 ))
|
local d=$(( b*c/8192+3*kib/16+1-32768 ))
|
||||||
local r=$(( (d*-335+16384)/32768+30 ))
|
local r=$(( (d*-335+16384)/32768+30 ))
|
||||||
|
|
||||||
if ! curl -F"file=@\"$g\"" https://0x0.st; then
|
if ! curl -f -F"file=@\"$g\"" https://0x0.st; then
|
||||||
printf "$bad" "oxo: failed to upload file: $f" >&2
|
printf "$bad" "oxo: failed to upload file: $f" >&2
|
||||||
else
|
else
|
||||||
: $((hits+=1))
|
: $((hits+=1))
|
||||||
|
|
Loading…
Reference in New Issue
Block a user