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

Handle missing viewpoint_names and make snapshot filename unique

Oliver Günther22058d376b36
diff --git a/app/models/attachment.rb b/app/models/attachment.rb
index b009ff305af..5b36c930b7c 100644
--- a/app/models/attachment.rb
+++ b/app/models/attachment.rb
@@ -153,6 +153,13 @@ class Attachment < ActiveRecord::Base
attributes['file']
end
+ ##
+ # Returns the file extension name,
+ # if any (with leading dot)
+ def extension
+ File.extname filename
+ end
+
def file=(file)
super.tap do
set_file_size file
diff --git a/modules/bim/lib/open_project/bim/bcf_xml/exporter.rb b/modules/bim/lib/open_project/bim/bcf_xml/exporter.rb
index 460b4ee700d..13b886e7a0c 100644
--- a/modules/bim/lib/open_project/bim/bcf_xml/exporter.rb
+++ b/modules/bim/lib/open_project/bim/bcf_xml/exporter.rb
@@ -127,8 +127,8 @@ module OpenProject::Bim::BcfXml
def viewpoints_for(issue_dir, issue)
[].tap do |files|
issue.viewpoints.find_each do |vp|
- vp_file = File.join(issue_dir, vp.viewpoint_name)
- snapshot_file = File.join(issue_dir, vp.snapshot.filename)
+ vp_file = File.join(issue_dir, "#{vp.uuid}.xml")
+ snapshot_file = File.join(issue_dir, "#{vp.uuid}#{vp.snapshot.extension}")
# Copy the files
dump_file vp_file, ViewpointWriter.new(vp).to_xml