Commit 69c37240 authored by Etienne Baqué's avatar Etienne Baqué

Merge branch '323714-enable-attachment_with_filename' into 'master'

Remove :attachment_with_filename feature flag [RUN ALL RSPEC] [RUN AS-IF-FOSS]

See merge request gitlab-org/gitlab!58977
parents 0d5e214f 13bd7f52
......@@ -7,7 +7,7 @@ module WorkhorseHelper
def send_git_blob(repository, blob, inline: true)
headers.store(*Gitlab::Workhorse.send_git_blob(repository, blob))
headers['Content-Disposition'] = inline ? 'inline' : content_disposition_attachment(repository.project, blob.name)
headers['Content-Disposition'] = content_disposition_for_blob(blob, inline)
# If enabled, this will override the values set above
workhorse_set_content_type!
......@@ -49,11 +49,9 @@ module WorkhorseHelper
headers[Gitlab::Workhorse::DETECT_HEADER] = "true"
end
def content_disposition_attachment(project, filename)
if Feature.enabled?(:attachment_with_filename, project, default_enabled: :yaml)
ActionDispatch::Http::ContentDisposition.format(disposition: 'attachment', filename: filename)
else
'attachment'
end
def content_disposition_for_blob(blob, inline)
return 'inline' if inline
ActionDispatch::Http::ContentDisposition.format(disposition: 'attachment', filename: blob.name)
end
end
---
title: Add blob filename to attachment content disposition
merge_request: 58977
author:
type: added
---
name: attachment_with_filename
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/55066
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/323714
milestone: '13.10'
type: development
group: group::editor
default_enabled: false
......@@ -45,17 +45,6 @@ RSpec.describe Projects::DesignManagement::Designs::RawImagesController do
expect(response).to have_gitlab_http_status(:ok)
end
context 'when the feature flag attachment_with_filename is disabled' do
it 'serves files with just `attachment` in the disposition header' do
stub_feature_flags(attachment_with_filename: false)
subject
expect(response.header['Content-Disposition']).to eq('attachment')
expect(response).to have_gitlab_http_status(:ok)
end
end
it 'serves files with Workhorse' do
subject
......
......@@ -36,16 +36,6 @@ RSpec.shared_examples 'raw snippet blob' do
expect(response.header['Content-Disposition']).to match "attachment; filename=\"#{filepath}\""
end
context 'when the feature flag attachment_with_filename is disabled' do
it 'returns just attachment in the disposition header' do
stub_feature_flags(attachment_with_filename: false)
subject
expect(response.header['Content-Disposition']).to eq 'attachment'
end
end
end
end
......
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