From 8914b08571e98653f56d1ca83d4e1708b5a7900f Mon Sep 17 00:00:00 2001 From: Martin Starman Date: Thu, 16 Apr 2026 13:52:13 +0200 Subject: [PATCH 1/2] if zip is not nmr nor bagit send converter --- lib/labimotion/libs/nmr_mapper.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/labimotion/libs/nmr_mapper.rb b/lib/labimotion/libs/nmr_mapper.rb index 7280dff..dd71b80 100644 --- a/lib/labimotion/libs/nmr_mapper.rb +++ b/lib/labimotion/libs/nmr_mapper.rb @@ -136,7 +136,7 @@ def handle_process_result(result, att, id, current_user) if result[:is_bagit] handle_bagit_result(att, id, current_user) elsif invalid_metadata?(result) - Labimotion::ConState::NONE + Labimotion::ConState::WAIT else handle_nmr_result(result, att, current_user) end From e33f99e454bc36b284bfd15d8b2dc65e987bc604 Mon Sep 17 00:00:00 2001 From: Martin Starman Date: Fri, 17 Apr 2026 05:51:08 +0000 Subject: [PATCH 2/2] Enabled zips to be converted if nor NMR or bagit --- lib/labimotion/libs/converter.rb | 2 +- lib/labimotion/libs/nmr_mapper.rb | 2 +- lib/labimotion/models/concerns/attachment_converter.rb | 1 + 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/labimotion/libs/converter.rb b/lib/labimotion/libs/converter.rb index e13b883..bce44c2 100644 --- a/lib/labimotion/libs/converter.rb +++ b/lib/labimotion/libs/converter.rb @@ -125,7 +125,7 @@ def self.handle_response(oat, response, current_user = {}) # rubocop: disable Me tmp_file.rewind filename = oat.filename - name = "#{File.basename(filename, '.*')}.zip" + name = "#{File.basename(filename, '.*')}#{File.extname(filename) == '.zip' ? '.bagit.zip' : '.zip'}" att = Attachment.new( filename: name, file_path: tmp_file.path, diff --git a/lib/labimotion/libs/nmr_mapper.rb b/lib/labimotion/libs/nmr_mapper.rb index dd71b80..49112ef 100644 --- a/lib/labimotion/libs/nmr_mapper.rb +++ b/lib/labimotion/libs/nmr_mapper.rb @@ -34,7 +34,7 @@ def process_ds(id, current_user = {}) return Labimotion::ConState::NONE if att.nil? result = process(att) - return Labimotion::ConState::NONE if result.nil? + return Labimotion::ConState::WAIT if result.nil? handle_process_result(result, att, id, current_user) end diff --git a/lib/labimotion/models/concerns/attachment_converter.rb b/lib/labimotion/models/concerns/attachment_converter.rb index f257c9b..1584717 100644 --- a/lib/labimotion/models/concerns/attachment_converter.rb +++ b/lib/labimotion/models/concerns/attachment_converter.rb @@ -31,6 +31,7 @@ def exec_converter case con_state when Labimotion::ConState::NMR self.con_state = Labimotion::NmrMapper.process_ds(id, current_user) + return exec_converter if con_state == Labimotion::ConState::WAIT update_column(:con_state, con_state) when Labimotion::ConState::WAIT self.con_state = Labimotion::Converter.jcamp_converter(id, current_user)