From fe1b8ea378f75dc224eeda3a1528d487d678515b Mon Sep 17 00:00:00 2001 From: Nehal Sharma <68962290+N-Shar-ma@users.noreply.github.com> Date: Mon, 4 Oct 2021 23:15:51 -0700 Subject: [PATCH] Fix FileExplorer Path Splitting Bug Signed-off-by: N-Shar-ma --- .../src/components/FileExplorer/FileExplorer.tsx | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/plugins/code-coverage/src/components/FileExplorer/FileExplorer.tsx b/plugins/code-coverage/src/components/FileExplorer/FileExplorer.tsx index 21052c0793..5cd25f37de 100644 --- a/plugins/code-coverage/src/components/FileExplorer/FileExplorer.tsx +++ b/plugins/code-coverage/src/components/FileExplorer/FileExplorer.tsx @@ -56,9 +56,12 @@ const buildFileStructure = (row: CoverageTableRow) => { (acc: FileStructureObject, cur: CoverageTableRow) => { let path = cur.filename; if (row.path) { - path = path?.split(`${row.path}/`)[1]; + if (path) { + path = '/' + path; + } + path = path?.split(`/${row.path}/`)[1]; } - const pathArray = path?.split('/'); + const pathArray = path?.split('/').filter(el => el!==''); if (!pathArray) { return acc;