mirror of
https://github.com/Homebrew/brew.git
synced 2025-07-14 16:09:03 +08:00
Don't URL-encode cookies.
This commit is contained in:
parent
eec2928754
commit
0a0672fade
@ -415,10 +415,7 @@ class CurlDownloadStrategy < AbstractFileDownloadStrategy
|
|||||||
def _curl_args
|
def _curl_args
|
||||||
args = []
|
args = []
|
||||||
|
|
||||||
if meta.key?(:cookies)
|
args += ["-b", meta.fetch(:cookies).map { |k, v| "#{k}=#{v}" }.join(";")] if meta.key?(:cookies)
|
||||||
escape_cookie = ->(cookie) { URI.encode_www_form([cookie]) }
|
|
||||||
args += ["-b", meta.fetch(:cookies).map(&escape_cookie).join(";")]
|
|
||||||
end
|
|
||||||
|
|
||||||
args += ["-e", meta.fetch(:referer)] if meta.key?(:referer)
|
args += ["-e", meta.fetch(:referer)] if meta.key?(:referer)
|
||||||
|
|
||||||
|
@ -215,15 +215,15 @@ describe CurlDownloadStrategy do
|
|||||||
let(:specs) {
|
let(:specs) {
|
||||||
{
|
{
|
||||||
cookies: {
|
cookies: {
|
||||||
coo: "kie",
|
coo: "k/e",
|
||||||
mon: "ster",
|
mon: "ster",
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
it "adds the appropriate curl args" do
|
it "adds the appropriate curl args and does not URL-encode the cookies" do
|
||||||
expect(subject).to receive(:system_command!) { |*, args:, **|
|
expect(subject).to receive(:system_command!) { |*, args:, **|
|
||||||
expect(args.each_cons(2)).to include(["-b", "coo=kie;mon=ster"])
|
expect(args.each_cons(2)).to include(["-b", "coo=k/e;mon=ster"])
|
||||||
}
|
}
|
||||||
|
|
||||||
subject.fetch
|
subject.fetch
|
||||||
|
Loading…
x
Reference in New Issue
Block a user