Commit 94f8895a authored by Vitaly Lipatov's avatar Vitaly Lipatov

eget: add have_end_slash and use it

parent 7150fcbd
...@@ -209,6 +209,11 @@ filter_order() ...@@ -209,6 +209,11 @@ filter_order()
sort -V | tail -n1 sort -V | tail -n1
} }
have_end_slash()
{
echo "$1" | grep -q '/$'
}
is_abs_path() is_abs_path()
{ {
echo "$1" | grep -q '^/' echo "$1" | grep -q '^/'
...@@ -1306,8 +1311,7 @@ make_fileurl() ...@@ -1306,8 +1311,7 @@ make_fileurl()
elif is_abs_path "$fn" ; then elif is_abs_path "$fn" ; then
# if there is file path from the root of the site # if there is file path from the root of the site
url="$(get_host_only "$url")" url="$(get_host_only "$url")"
elif echo "$url" | grep -q -v "/$" ; then elif ! have_end_slash "$url" ; then
# if there is no slash in the end of URL
url="$(dirname "$url")" url="$(dirname "$url")"
fi fi
...@@ -1375,9 +1379,7 @@ if [ -n "$2" ] ; then ...@@ -1375,9 +1379,7 @@ if [ -n "$2" ] ; then
URL="$1" URL="$1"
MASK="$2" MASK="$2"
else else
# do not support / at the end without separately specified mask if have_end_slash "$1" ; then
if echo "$1" | grep -q "/$" ; then
#fatal "Use http://example.com/e/* to download all files in dir"
URL="$1" URL="$1"
MASK="" MASK=""
else else
......
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