Commit c51a275d authored by Vitaly Lipatov's avatar Vitaly Lipatov

eget: add support for utf-8 filename in Content-disposition

parent 723f0d9c
......@@ -1027,10 +1027,11 @@ url_get_filename()
! is_httpurl "$URL" && basename "$URL" && return
# See https://www.cpcwood.com/blog/5-aws-s3-utf-8-content-disposition
# https://www.rfc-editor.org/rfc/rfc6266
local cd="$(url_get_header "$URL" "Content-Disposition")"
if echo "$cd" | grep -q "filename\*=UTF-8" ; then
if echo "$cd" | grep -qi "filename\*=UTF-8" ; then
#Content-Disposition: attachment; filename="unityhub-amd64-3.3.0.deb"; filename*=UTF-8''"unityhub-amd64-3.3.0.deb"
echo "$cd" | sed -e "s|.*filename\*=UTF-8''||" -e 's|^"||' -e 's|";$||' -e 's|"$||'
echo "$cd" | sed -e "s|.*filename\*=UTF-8''||" -e "s|.*filename\*=utf-8''||" -e 's|^"||' -e 's|";$||' -e 's|"$||'
return
fi
if echo "$cd" | grep -q "filename=" ; then
......
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