diff --git a/packages/ketcher-react/src/script/ui/utils/fileOpener.js b/packages/ketcher-react/src/script/ui/utils/fileOpener.js index f9b8a0976c..049d15b986 100644 --- a/packages/ketcher-react/src/script/ui/utils/fileOpener.js +++ b/packages/ketcher-react/src/script/ui/utils/fileOpener.js @@ -45,7 +45,13 @@ function throughFileReader(file) { const rd = new FileReader(); // eslint-disable-line no-undef rd.onload = () => { - const content = isCDX ? rd.result.slice(37) : rd.result; + let content; + if (isCDX) { + const base64String = rd.result.split(',').at(-1); + content = base64String; + } else { + content = rd.result; + } if (file.msClose) file.msClose(); resolve(content); };