From 3f48d8bd5d1de650c7a1bcebee3f5076ba77ba48 Mon Sep 17 00:00:00 2001 From: Sergey Linev Date: Tue, 3 Sep 2024 13:03:57 +0200 Subject: [PATCH] Fix - avoid duplications in files list --- modules/gui/HierarchyPainter.mjs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/modules/gui/HierarchyPainter.mjs b/modules/gui/HierarchyPainter.mjs index badea509e..4857a355e 100644 --- a/modules/gui/HierarchyPainter.mjs +++ b/modules/gui/HierarchyPainter.mjs @@ -2760,7 +2760,7 @@ class HierarchyPainter extends BasePainter { async listServerDir(dirname) { return httpRequest(dirname, 'text').then(res => { if (!res) return false; - const h = { _name: 'Files', _kind: kTopFolder, _childs: [], _isopen: true }; + const h = { _name: 'Files', _kind: kTopFolder, _childs: [], _isopen: true }, fmap = {}; let p = 0; while (p < res.length) { p = res.indexOf('a href="', p+1); @@ -2771,6 +2771,10 @@ class HierarchyPainter extends BasePainter { const fname = res.slice(p, p2); p = p2 + 1; + + if (fmap[fname]) continue; + fmap[fname] = true; + if ((fname.lastIndexOf('.root') === fname.length - 5) && (fname.length > 5)) { h._childs.push({ _name: fname, _title: dirname + fname, _url: dirname + fname, _kind: kindTFile,