From 9d3046386f7e7c19608a823280ce29263332eb0a Mon Sep 17 00:00:00 2001 From: Samir Kamal <1954121+skamril@users.noreply.github.com> Date: Sat, 30 Sep 2023 08:36:38 +0200 Subject: [PATCH] fix(ui-debug): issue to display json file in outputs (#1747) --- .../Modelization/DebugView/StudyDataView/StudyFileView.tsx | 2 +- .../explore/Modelization/DebugView/StudyTreeView/utils.ts | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/webapp/src/components/App/Singlestudy/explore/Modelization/DebugView/StudyDataView/StudyFileView.tsx b/webapp/src/components/App/Singlestudy/explore/Modelization/DebugView/StudyDataView/StudyFileView.tsx index ddba819ae2..1a35c18add 100644 --- a/webapp/src/components/App/Singlestudy/explore/Modelization/DebugView/StudyDataView/StudyFileView.tsx +++ b/webapp/src/components/App/Singlestudy/explore/Modelization/DebugView/StudyDataView/StudyFileView.tsx @@ -40,7 +40,7 @@ function StudyFileView(props: PropTypes) { setLoaded(false); try { const res = await getStudyData(study, url); - if (typeof res === "object") { + if (Array.isArray(res)) { setData(res.join("\n")); } else { setData(res); diff --git a/webapp/src/components/App/Singlestudy/explore/Modelization/DebugView/StudyTreeView/utils.ts b/webapp/src/components/App/Singlestudy/explore/Modelization/DebugView/StudyTreeView/utils.ts index ea0b7d6cb5..cc3f8ceeee 100644 --- a/webapp/src/components/App/Singlestudy/explore/Modelization/DebugView/StudyTreeView/utils.ts +++ b/webapp/src/components/App/Singlestudy/explore/Modelization/DebugView/StudyTreeView/utils.ts @@ -15,10 +15,10 @@ export const getStudyParams = ( path: string, itemkey: string ): StudyParams | undefined => { - if (typeof data !== "object") { + if (typeof data === "string") { const tmp = data.split("://"); if (tmp && tmp.length > 0) { - if (tmp[0] === "json") { + if (tmp[0] === "json" || tmp[1].endsWith(".json")) { return { type: "json", data: `${path}/${itemkey}`,