Commit ad7bcf8a authored by Vitaly Lipatov's avatar Vitaly Lipatov

eget: add is_wildcard/is_query_string, replace grep in glob checks

parent 879b9d4f
......@@ -2444,7 +2444,7 @@ if [ -n "$INPUTFILE" ] ; then
fi
# https://www.freeoffice.com/download.php?filename=freeoffice-2021-1062.x86_64.rpm
if [ -z "$NOGLOB" ] && echo "$URL" | grep -q -P "[*\[\]]" ; then
if [ -z "$NOGLOB" ] && is_wildcard "$URL" && ! is_query_string "$URL" ; then
fatal "Error: there are globbing symbol (*[]) in $URL. It is allowed only for mask part"
fi
......@@ -2474,13 +2474,18 @@ fi
is_wildcard()
{
echo "$1" | grep -q "[*?]" && return
echo "$1" | grep -q "\]" && return
echo "$1" | grep -q "\[" && return
case "$1" in *[*?]*|*\[*|*\]*) return 0 ;; esac
return 1
}
is_query_string()
{
case "$1" in *\?*=*) return 0 ;; esac
return 1
}
# If there is no wildcard symbol like asterisk, just download
if [ -z "$SEPMASK" ] && ! is_wildcard "$MASK" || echo "$MASK" | grep -q "[?].*="; then
if [ -z "$SEPMASK" ] && ! is_wildcard "$MASK" || is_query_string "$MASK" ; then
sget "$1" "$TARGETFILE"
exit
fi
......
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