Commit d8c62de7 authored by Vitaly Lipatov's avatar Vitaly Lipatov

eget: rewrite get_filename with get_real_url

parent 4d6a88da
...@@ -769,6 +769,9 @@ url_get_real_url() ...@@ -769,6 +769,9 @@ url_get_real_url()
url_get_filename() url_get_filename()
{ {
local URL="$1" local URL="$1"
! is_httpurl "$URL" && basename "$URL" && return
# FIXME with wget # FIXME with wget
local cd="$(url_get_header "$URL" "Content-Disposition")" local cd="$(url_get_header "$URL" "Content-Disposition")"
if echo "$cd" | grep -q "filename=" ; then if echo "$cd" | grep -q "filename=" ; then
...@@ -777,13 +780,7 @@ url_get_filename() ...@@ -777,13 +780,7 @@ url_get_filename()
return return
fi fi
local loc="$(url_get_header "$URL" "Location" | tail -n1)" basename "$(url_get_real_url "$URL")"
if is_url "$loc" ; then
basename "$loc"
return
fi
basename "$URL"
} }
else else
...@@ -860,6 +857,9 @@ url_get_real_url() ...@@ -860,6 +857,9 @@ url_get_real_url()
url_get_filename() url_get_filename()
{ {
local URL="$1" local URL="$1"
! is_httpurl "$URL" && basename "$URL" && return
# FIXME with wget # FIXME with wget
local cd="$(url_get_header "$URL" "content-disposition")" local cd="$(url_get_header "$URL" "content-disposition")"
if echo "$cd" | grep -q "filename=" ; then if echo "$cd" | grep -q "filename=" ; then
...@@ -868,13 +868,7 @@ url_get_filename() ...@@ -868,13 +868,7 @@ url_get_filename()
return return
fi fi
local loc="$(url_get_header "$URL" "location" | tail -n1)" basename "$(url_get_real_url "$URL")"
if is_url "$loc" ; then
basename "$loc"
return
fi
basename "$URL"
} }
......
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