From 370ed65bbb03abb7190b0c31a359dc8d996d9d1c Mon Sep 17 00:00:00 2001 From: Wieland Lindenthal Date: Fri, 24 May 2019 17:43:20 +0200 Subject: [PATCH] Fix BCF-XML API endpoint to use new importer initialization Provide propper options for Importer --- modules/bcf/lib/api/v3/bcf_xml/bcf_xml_api.rb | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/modules/bcf/lib/api/v3/bcf_xml/bcf_xml_api.rb b/modules/bcf/lib/api/v3/bcf_xml/bcf_xml_api.rb index fa979d1599..fda556eb0b 100644 --- a/modules/bcf/lib/api/v3/bcf_xml/bcf_xml_api.rb +++ b/modules/bcf/lib/api/v3/bcf_xml/bcf_xml_api.rb @@ -50,6 +50,10 @@ module API def post_request? request.env['REQUEST_METHOD'] == 'POST' end + + def import_options + params[:import_options].presence || {} + end end post do @@ -61,8 +65,10 @@ module API begin file = params[:bcf_xml_file][:tempfile] - importer = ::OpenProject::Bcf::BcfXml::Importer.new project, current_user: current_user - importer.import! file + importer = ::OpenProject::Bcf::BcfXml::Importer.new(file, + project, + current_user: User.current) + importer.import! import_options rescue StandardError => e raise API::Errors::InternalError.new e.message ensure