Commit 05d6ef22 authored by Vitaly Lipatov's avatar Vitaly Lipatov

eget: fix get real filename for redirects with tags

parent 62130338
...@@ -240,6 +240,7 @@ is_strange_url() ...@@ -240,6 +240,7 @@ is_strange_url()
{ {
local URL="$1" local URL="$1"
is_url "$URL" || return is_url "$URL" || return
#echo "$URL" | grep -q -E "\.(deb|rpm|zip)\?" && return 1
echo "$URL" | grep -q "[?&]" echo "$URL" | grep -q "[?&]"
} }
...@@ -1205,7 +1206,7 @@ url_get_header() ...@@ -1205,7 +1206,7 @@ url_get_header()
url_get_headers "$URL" | grep -i "^ *$HEADER: " | sed -e "s|^ *$HEADER: ||i" url_get_headers "$URL" | grep -i "^ *$HEADER: " | sed -e "s|^ *$HEADER: ||i"
} }
url_get_real_url() url_get_raw_real_url()
{ {
local URL="$1" local URL="$1"
...@@ -1220,15 +1221,28 @@ url_get_real_url() ...@@ -1220,15 +1221,28 @@ url_get_real_url()
if is_abs_path "$loc" ; then if is_abs_path "$loc" ; then
loc="$(concatenate_url_and_filename "$(get_host_only "$URL")" "$loc")" #" loc="$(concatenate_url_and_filename "$(get_host_only "$URL")" "$loc")" #"
fi fi
if ! is_strange_url "$loc" ; then echo "$loc"
echo "$loc" return
return
fi
done done
echo "$URL" echo "$URL"
} }
url_get_real_url()
{
local URL="$1"
local loc
loc="$(url_get_raw_real_url "$URL")"
# we need stay with original url due redirect tags
if ! is_strange_url "$loc" ; then
echo "$loc"
return
fi
echo "$URL"
}
url_get_filename() url_get_filename()
{ {
local URL="$1" local URL="$1"
...@@ -1250,7 +1264,11 @@ url_get_filename() ...@@ -1250,7 +1264,11 @@ url_get_filename()
return return
fi fi
basename "$(url_get_real_url "$URL")" local loc="$(url_get_raw_real_url "$URL")"
if is_strange_url "$loc" ; then
loc="$(echo "$loc" | sed -e "s|\?.*||")"
fi
basename "$loc"
} }
fi 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