From 43f0e5c91d78802662a5d10b77684c5324962ea1 Mon Sep 17 00:00:00 2001 From: tomasz1986 Date: Mon, 12 Sep 2022 08:19:29 +0200 Subject: [PATCH] gui: Fix error in Restore Versions when path exists as both directory and file (fixes #7068) (#8532) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The current code checks whether the same-named item exists in the tree, and when it does, it re-uses it when adding new children to it. However, the code doesn't check whether the existing item is a folder or a file. It rather assumes that it is always a folder, which is not necessarily the case. This commit adds a new check to the code, so that the existing element is reused only when it is a folder, and ignored otherwise. Signed-off-by: Tomasz WilczyƄski --- gui/default/syncthing/app.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gui/default/syncthing/app.js b/gui/default/syncthing/app.js index 87e33dfc4..94b4a5f61 100644 --- a/gui/default/syncthing/app.js +++ b/gui/default/syncthing/app.js @@ -184,7 +184,7 @@ function buildTree(children) { keySoFar.push(part); var found = false; for (var i = 0; i < parent.children.length; i++) { - if (parent.children[i].title == part) { + if (parent.children[i].title == part && parent.children[i].folder === true) { parent = parent.children[i]; found = true; break;