mirror of
https://github.com/Homebrew/brew.git
synced 2025-07-14 16:09:03 +08:00
download_strategy: add comment about Content-Disposition handling
This commit is contained in:
parent
9d2ee344f6
commit
d330e915d1
@ -458,6 +458,9 @@ class CurlDownloadStrategy < AbstractFileDownloadStrategy
|
||||
filename = URI.decode_www_form_component(encoded_filename).encode(encoding) if encoding && encoded_filename
|
||||
end
|
||||
|
||||
# Servers may include '/' in their Content-Disposition filename header. Take only the basename of this, because:
|
||||
# - Unpacking code assumes this is a single file - not something living in a subdirectory.
|
||||
# - Directory traversal attacks are possible without limiting this to just the basename.
|
||||
(filename || content_disposition.filename).rpartition("/")[-1]
|
||||
end
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user