From 031579eaeddca5e70012dd5f4da3d09622de997a Mon Sep 17 00:00:00 2001 From: Nikita Date: Mon, 14 Aug 2023 09:33:23 +0300 Subject: [PATCH] =?UTF-8?q?#3091=20=E2=80=93=20Cannot=20open=20CDX=20files?= =?UTF-8?q?=20on=20Mac=20(#3092)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/ketcher-react/src/script/ui/utils/fileOpener.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) 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); };