Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
eget
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
etersoft
eget
Commits
ac56650d
Commit
ac56650d
authored
Dec 16, 2025
by
Vitaly Lipatov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
eget: improve --get-filename
parent
b6cc7bd8
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
5 deletions
+18
-5
eget
eget
+18
-5
No files found.
eget
View file @
ac56650d
...
...
@@ -1461,27 +1461,40 @@ url_get_filename()
!
is_httpurl
"
$URL
"
&&
basename
"
$URL
"
&&
return
local
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
#Content-Disposition: attachment; filename="unityhub-amd64-3.3.0.deb"; filename*=UTF-8''"unityhub-amd64-3.3.0.deb"
#Content-Disposition: attachment; filename*=UTF-8''t1client-standalone-4.5.28.0-1238402-Release.deb; filename="t1client-standalone-4.5.28.0-1238402-Release.deb"
echo
"
$cd
"
|
sed
-
e
"s|.*filename
\*
= *UTF-8''||i"
-
e
's|^"||'
-
e
's|";$||'
-
e
's|"$||'
-
e
's|; filename=.*||'
return
filename
=
"
$(
echo
"
$cd
"
|
sed
-e
"s|.*filename
\*
= *UTF-8''||i"
-e
's|^"||'
-e
's|";$||'
-e
's|"$||'
-e
's|; filename=.*||'
)
"
[
"
$filename
"
!=
"unspecified"
]
&&
echo
"
$filename
"
&&
return
fi
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= *||i'
-
e
's|^"||'
-
e
's|";.*||'
-
e
's|"$||'
return
filename
=
"
$(
echo
"
$cd
"
|
sed
-e
's|.*filename= *||i'
-e
's|^"||'
-e
's|";.*||'
-e
's|"$||'
)
"
[
"
$filename
"
!=
"unspecified"
]
&&
echo
"
$filename
"
&&
return
fi
local
loc
=
"
$(
url_get_raw_real_url
"
$URL
"
)
"
if
is_strange_url
"
$loc
"
;
then
loc
=
"
$(
echo
"
$loc
"
|
sed
-e
"s|
\?
.*||"
)
"
fi
basename
"
$loc
"
# hack for redirect to the main page
if
dirname
"
$loc
"
|
grep
-
q
"^http"
;
then
loc
=
""
fi
local
loc
=
"
$URL
"
if
is_strange_url
"
$loc
"
;
then
loc
=
"
$(
echo
"
$loc
"
|
sed
-e
"s|
\?
.*||"
)
"
fi
[
-
n
"
$loc
"
]
&&
basename
"
$loc
"
}
fi
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment