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

Use original_filename if present

Oliver Güntherd166180a30fd
diff --git a/modules/bim/app/models/bim/ifc_models/ifc_model.rb b/modules/bim/app/models/bim/ifc_models/ifc_model.rb
index 6499e433d06..801cf04de62 100644
--- a/modules/bim/app/models/bim/ifc_models/ifc_model.rb
+++ b/modules/bim/app/models/bim/ifc_models/ifc_model.rb
@@ -25,9 +25,10 @@ module Bim
end
delete_attachment name
+ filename = file.respond_to?(:original_filename) ? file.original_filename : File.basename(file.path)
call = ::Attachments::CreateService
.bypass_whitelist(user: User.current)
- .call(file: file, container: self, filename: File.basename(file.path), description: name)
+ .call(file: file, container: self, filename: filename, description: name)
call.on_failure { Rails.logger.error "Failed to add #{name} attachment: #{call.message}" }
end