Skip to content

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

Fix content of viewpoint image to get correct content type

Oliver Günther4d1efab3c669
diff --git a/modules/bim/spec/factories/bcf_viewpoint_attachment_factory.rb b/modules/bim/spec/factories/bcf_viewpoint_attachment_factory.rb
index 84d091df055..31a583e0ff7 100644
--- a/modules/bim/spec/factories/bcf_viewpoint_attachment_factory.rb
+++ b/modules/bim/spec/factories/bcf_viewpoint_attachment_factory.rb
@@ -29,13 +29,15 @@
FactoryBot.define do
factory :bcf_viewpoint_attachment, class: 'Attachment' do
description { "snapshot" }
- filename { "snapshot.jpg" }
+ filename { "image.png" }
content_type { "image/jpeg" }
author { User.current }
file do
- OpenProject::Files.create_uploaded_file name: filename,
- content_type: content_type,
- binary: true
+ Rack::Test::UploadedFile.new(
+ Rails.root.join("spec/fixtures/files/image.png"),
+ 'image/png',
+ true,
+ )
end
end
end
diff --git a/modules/bim/spec/requests/api/bcf/v2_1/viewpoints_api_spec.rb b/modules/bim/spec/requests/api/bcf/v2_1/viewpoints_api_spec.rb
index 87aa1c53fad..b672b7dd5e0 100644
--- a/modules/bim/spec/requests/api/bcf/v2_1/viewpoints_api_spec.rb
+++ b/modules/bim/spec/requests/api/bcf/v2_1/viewpoints_api_spec.rb
@@ -202,7 +202,7 @@ describe 'BCF 2.1 viewpoints resource', type: :request, content_type: :json, wit
it 'responds with the attachment with the appropriate content type and cache headers' do
expect(subject.status).to eq 200
- expect(subject.headers['Content-Type']).to eq 'image/jpeg'
+ expect(subject.headers['Content-Type']).to eq 'image/png'
max_age = OpenProject::Configuration.fog_download_url_expires_in - 10