Commit f58e7aaf authored by Vitaly Lipatov's avatar Vitaly Lipatov

eget: check filename in Content-Disposition in case insensivity

parent c51a275d
......@@ -1029,15 +1029,15 @@ url_get_filename()
# 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 -qi "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|.*filename\*=utf-8''||" -e 's|^"||' -e 's|";$||' -e 's|"$||'
echo "$cd" | sed -e "s|.*filename\*= *UTF-8''||i" -e 's|^"||' -e 's|";$||' -e 's|"$||'
return
fi
if echo "$cd" | grep -q "filename=" ; then
if echo "$cd" | grep -qi "filename=" ; then
#Content-Disposition: attachment; filename=postman-linux-x64.tar.gz
#content-disposition: attachment; filename="code-1.77.1-1680651749.el7.x86_64.rpm"
echo "$cd" | sed -e 's|.*filename=||' -e 's|^"||' -e 's|";.*||' -e 's|"$||'
echo "$cd" | sed -e 's|.*filename= *||i' -e 's|^"||' -e 's|";.*||' -e 's|"$||'
return
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