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
MASK="$2"
else
# drop mask part
URL="$(dirname "$1")"
URL="$(dirname "$1")/"
fi
if [ -z "$MASK" ] && echo "$URL" | grep -q "[*?]" ; then
......@@ -477,16 +477,26 @@ make_fileurl()
{
local url="$1"
local fn="$2"
fn="$(echo "$fn" | sed -e 's|^./||' -e 's|^/+||')"
if is_fileurl "$url" ; then
echo "$url/$fn"
return
fi
# if there is file path from the root of the site
if echo "$fn" | grep -q "^/" ; then
echo "$(get_host_only "$url")$fn"
return
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
echo "$(echo "$url" | sed -e 's|/*$||')/$fn"
}
......@@ -513,7 +523,7 @@ fi
ERROR=0
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
[ -n "$TARGETFILE" ] && [ "$ERROR" = "0" ] && break
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