OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
[31205] Fix attachment disposition for local files
Oliver Günther50828e930a26
diff --git a/lib/api/helpers/attachment_renderer.rb b/lib/api/helpers/attachment_renderer.rbindex 5ae693317f0..49fbe4d4ff6 100644--- a/lib/api/helpers/attachment_renderer.rb+++ b/lib/api/helpers/attachment_renderer.rb@@ -43,7 +43,7 @@ module APIredirect attachment.external_url.to_selsecontent_type attachment.content_type- header['Content-Disposition'] = attachment.content_disposition+ header['Content-Disposition'] = "#{attachment.content_disposition}; filename=#{attachment.filename}"env['api.format'] = :binaryattachment.diskfile.readenddiff --git a/spec/requests/api/v3/attachments/attachment_resource_shared_examples.rb b/spec/requests/api/v3/attachments/attachment_resource_shared_examples.rbindex ccace9fe912..a67429ddf8a 100644--- a/spec/requests/api/v3/attachments/attachment_resource_shared_examples.rb+++ b/spec/requests/api/v3/attachments/attachment_resource_shared_examples.rb@@ -287,14 +287,14 @@ shared_examples 'an APIv3 attachment resource', type: :request, content_type: :jcontext 'for a local text file' doit_behaves_like 'for a local file' dolet(:mock_file) { FileHelpers.mock_uploaded_file name: 'foobar.txt' }- let(:content_disposition) { "inline" }+ let(:content_disposition) { "inline; filename=foobar.txt" }endendcontext 'for a local binary file' doit_behaves_like 'for a local file' dolet(:mock_file) { FileHelpers.mock_uploaded_file name: 'foobar.dat', content_type: "application/octet-stream" }- let(:content_disposition) { "attachment" }+ let(:content_disposition) { "attachment; filename=foobar.dat" }endend