From 461d06dad9260b593beff9c627958d57d0125201 Mon Sep 17 00:00:00 2001 From: ajugo Date: Mon, 20 Feb 2023 10:14:32 +0100 Subject: [PATCH] Fix import protocol [SCI-7915] (#4980) --- .../javascripts/protocols/import_export/import.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/app/assets/javascripts/protocols/import_export/import.js b/app/assets/javascripts/protocols/import_export/import.js index 685583b40..568aa5dc9 100644 --- a/app/assets/javascripts/protocols/import_export/import.js +++ b/app/assets/javascripts/protocols/import_export/import.js @@ -1,3 +1,4 @@ +/* eslint-disable no-param-reassign */ /* eslint-disable no-unused-vars, lines-around-comment, no-undef, no-alert */ /* eslint-disable no-use-before-define, no-restricted-globals */ //= require protocols/import_export/eln_table.js @@ -48,10 +49,18 @@ function importProtocolFromFile( return (parseInt($(a).attr('position'), 10) - parseInt($(b).attr('position'), 10)); } + function cleanFilePath(filePath) { + if (filePath.slice(-1) === '.') { + filePath = filePath.substring(0, filePath.length - 1); + } + + return filePath; + } + function getAssetBytes(folder, stepGuid, fileRef) { var stepPath = stepGuid ? stepGuid + '/' : ''; var filePath = folder + stepPath + fileRef; - var assetBytes = zipFiles.files[filePath].asBinary(); + var assetBytes = zipFiles.files[cleanFilePath(filePath)].asBinary(); return window.btoa(assetBytes); }