Commit f9c68a01 authored by Vitaly Lipatov's avatar Vitaly Lipatov

eget: make correct URL if file part parsed by mask separately

parent 66c0571f
...@@ -449,7 +449,7 @@ if [ -n "$2" ] ; then ...@@ -449,7 +449,7 @@ if [ -n "$2" ] ; then
MASK="$2" MASK="$2"
else else
# drop mask part # drop mask part
URL="$(dirname "$1")" URL="$(dirname "$1")/"
fi fi
if [ -z "$MASK" ] && echo "$URL" | grep -q "[*?]" ; then if [ -z "$MASK" ] && echo "$URL" | grep -q "[*?]" ; then
...@@ -477,16 +477,26 @@ make_fileurl() ...@@ -477,16 +477,26 @@ make_fileurl()
{ {
local url="$1" local url="$1"
local fn="$2" local fn="$2"
fn="$(echo "$fn" | sed -e 's|^./||' -e 's|^/+||')" fn="$(echo "$fn" | sed -e 's|^./||' -e 's|^/+||')"
if is_fileurl "$url" ; then if is_fileurl "$url" ; then
echo "$url/$fn" echo "$url/$fn"
return return
fi fi
# if there is file path from the root of the site # if there is file path from the root of the site
if echo "$fn" | grep -q "^/" ; then if echo "$fn" | grep -q "^/" ; then
echo "$(get_host_only "$url")$fn" echo "$(get_host_only "$url")$fn"
return return
fi fi
# if there is no slash in the end of URL
if echo "$url" | grep -q -v "/$" ; then
echo "$(dirname "$url" | sed -e 's|/*$||')/$fn"
return
fi
# workaround for a slash in the end of URL # workaround for a slash in the end of URL
echo "$(echo "$url" | sed -e 's|/*$||')/$fn" echo "$(echo "$url" | sed -e 's|/*$||')/$fn"
} }
...@@ -513,7 +523,7 @@ fi ...@@ -513,7 +523,7 @@ fi
ERROR=0 ERROR=0
for fn in $(get_urls | filter_glob "$MASK" | filter_order) ; do for fn in $(get_urls | filter_glob "$MASK" | filter_order) ; do
is_url "$fn" || fn="$(make_fileurl "$URL" "$(basename "$fn")" )" #" is_url "$fn" || fn="$(make_fileurl "$URL" "$fn" )" #"
sget "$fn" "$TARGETFILE" || ERROR=1 sget "$fn" "$TARGETFILE" || ERROR=1
[ -n "$TARGETFILE" ] && [ "$ERROR" = "0" ] && break [ -n "$TARGETFILE" ] && [ "$ERROR" = "0" ] && break
done done
......
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