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 double render bug in BCF XML import

Wieland Lindenthal6ba3e4d74499
diff --git a/modules/bim/app/controllers/bim/bcf/issues_controller.rb b/modules/bim/app/controllers/bim/bcf/issues_controller.rb
index d4125c72894..9bb775a432c 100644
--- a/modules/bim/app/controllers/bim/bcf/issues_controller.rb
+++ b/modules/bim/app/controllers/bim/bcf/issues_controller.rb
@@ -68,6 +68,21 @@ module Bim
end
def perform_import
+ import_file
+ rescue StandardError => e
+ flash[:error] = I18n.t('bcf.bcf_xml.import_failed', error: e.message)
+ redirect_to action: :upload
+ ensure
+ @bcf_attachment&.destroy
+ end
+
+ def redirect_to_bcf_issues_listset
+ redirect_to defaults_bcf_project_ifc_models_path(@project)
+ end
+
+ private
+
+ def import_file
set_import_options
results = @importer.import!(@import_options).flatten
@@ -79,19 +94,8 @@ module Bim
@issues[:successful] << issue
end
end
- rescue StandardError => e
- flash[:error] = I18n.t('bcf.bcf_xml.import_failed', error: e.message)
- redirect_to action: :upload
- ensure
- @bcf_attachment&.destroy
end
- def redirect_to_bcf_issues_list
- redirect_to defaults_bcf_project_ifc_models_path(@project)
- end
-
- private
-
def import_canceled?
if %i[unknown_types_action
unknown_statuses_action
@@ -133,7 +137,7 @@ module Bim
elsif render_config_non_members?
render_config_non_members
else
- perform_import
+ import_file
render :perform_import
end
end