Commit fe3d03ea authored by Vitaly Lipatov's avatar Vitaly Lipatov

eget: validate numeric input for --tries option

parent 3ada53b4
......@@ -270,6 +270,11 @@ cid_from_url()
echo "$1" | sed -e 's|^ipfs://*||' -e 's|\?.*||'
}
is_numeric()
{
echo "$1" | grep -qE '^[0-9]+$'
}
# args: cmd <URL> <options>
# will run cmd <options> <URL>
......@@ -609,6 +614,9 @@ while [ -n "$1" ] ; do
;;
*)
if ! is_numeric "$argvalue" ; then
fatal "Invalid value for --tries: '$argvalue' (must be a number, 0, or 'inf')"
fi
WGETTRIES="--tries $argvalue"
CURLRETRY="--retry $(($argvalue-1))"
;;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment