diff options
author | Stan Hu <stanhu@gmail.com> | 2019-02-04 17:27:22 -0800 |
---|---|---|
committer | Stan Hu <stanhu@gmail.com> | 2019-02-04 23:12:44 -0800 |
commit | 41b51c065604091579a2308adc527fe5bb187abe (patch) | |
tree | a3730ea8e6310ec0012d801791576e2940ad3ec4 /spec/features/projects/artifacts/user_downloads_artifacts_spec.rb | |
parent | 4b07f22d93de1417ab7918ffd982e35526b50c6e (diff) | |
download | gitlab-ce-41b51c065604091579a2308adc527fe5bb187abe.tar.gz |
Encode Content-Disposition filenames
Users downloading non-ASCII attachments would see garbled characters.
When used with object storage, AWS S3 would return an InvalidArgument
error: Header value cannot be represented using ISO-8859-1.
Per RFC 5987 and RFC 6266, Content-Disposition should be encoded
properly. This commit takes the Rails 6 implementation of
ActiveSuppport::Http::ContentDisposition
(https://github.com/rails/rails/pull/33829) and ports it here.
Closes https://gitlab.com/gitlab-org/gitlab-ce/issues/47673
Diffstat (limited to 'spec/features/projects/artifacts/user_downloads_artifacts_spec.rb')
-rw-r--r-- | spec/features/projects/artifacts/user_downloads_artifacts_spec.rb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/spec/features/projects/artifacts/user_downloads_artifacts_spec.rb b/spec/features/projects/artifacts/user_downloads_artifacts_spec.rb index 554f0b49052..5cb015e80be 100644 --- a/spec/features/projects/artifacts/user_downloads_artifacts_spec.rb +++ b/spec/features/projects/artifacts/user_downloads_artifacts_spec.rb @@ -7,7 +7,7 @@ describe "User downloads artifacts" do shared_examples "downloading" do it "downloads the zip" do - expect(page.response_headers["Content-Disposition"]).to eq(%Q{attachment; filename="#{job.artifacts_file.filename}"}) + expect(page.response_headers["Content-Disposition"]).to eq(%Q{attachment; filename*=UTF-8''#{job.artifacts_file.filename}; filename="#{job.artifacts_file.filename}"}) expect(page.response_headers['Content-Transfer-Encoding']).to eq("binary") expect(page.response_headers['Content-Type']).to eq("application/zip") expect(page.source.b).to eq(job.artifacts_file.file.read.b) |