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
Fix BCF import by providing a non-ok status
Oliver Günther2ed8382fcfc8
diff --git a/modules/bim/app/controllers/bim/bcf/issues_controller.rb b/modules/bim/app/controllers/bim/bcf/issues_controller.rbindex b9cb9066c73..11949e96083 100644--- a/modules/bim/app/controllers/bim/bcf/issues_controller.rb+++ b/modules/bim/app/controllers/bim/bcf/issues_controller.rb@@ -50,21 +50,21 @@ module Bimrender_nextrescue StandardError => eflash[:error] = I18n.t("bcf.bcf_xml.import_failed", error: e.message)- redirect_to action: :upload+ upload_error_redirectenddef configure_importrender_nextrescue StandardError => eflash[:error] = I18n.t("bcf.bcf_xml.import_failed", error: e.message)- redirect_to action: :upload+ upload_error_redirectenddef perform_importimport_filerescue StandardError => eflash[:error] = I18n.t("bcf.bcf_xml.import_failed", error: e.message)- redirect_to action: :upload+ upload_error_redirectensure@bcf_attachment&.destroyend@@ -75,6 +75,10 @@ module Bimprivate+ def upload_error_redirect+ redirect_to action: :upload, status: :unprocessable_entity+ end+def import_fileset_import_options@@ -117,6 +121,8 @@ module Bimenddef render_next+ response.status = :unprocessable_entity+if render_config_unknown_types?render_config_unknown_typeselsif render_config_unknown_statuses?@@ -194,7 +200,7 @@ module Bim@bcf_xml_file = File.new @bcf_attachment.local_pathrescue ActiveRecord::RecordNotFoundflash[:error] = I18n.t("bcf.bcf_xml.import.bcf_file_not_found")- redirect_to action: :upload+ upload_error_redirectenddef persist_file@@ -203,7 +209,7 @@ module Bimsession[:bcf_file_id] = @bcf_attachment.idrescue StandardError => eflash[:error] = "Failed to persist BCF file: #{e.message}"- redirect_to action: :upload+ upload_error_redirectenddef create_attachment@@ -223,7 +229,7 @@ module Bimpath = params[:bcf_file]&.pathunless path && File.readable?(path)flash[:error] = I18n.t("bcf.bcf_xml.import_failed", error: "File missing or not readable")- redirect_to action: :upload+ upload_error_redirectendend@@ -232,7 +238,7 @@ module Bimflash[:error] =I18n.t("bcf.bcf_xml.import_failed_unsupported_bcf_version",minimal_version: OpenProject::Bim::BcfXml::Importer::MINIMUM_BCF_VERSION)- redirect_to action: :upload+ upload_error_redirectendendend