mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2024-12-25 09:13:05 +08:00
Fix import protocol [SCI-7915] (#4980)
This commit is contained in:
parent
c92faeb48c
commit
461d06dad9
1 changed files with 10 additions and 1 deletions
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue