summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortomasz1986 <twilczynski@naver.com>2022-09-12 08:19:29 +0200
committerGitHub <noreply@github.com>2022-09-12 08:19:29 +0200
commit43f0e5c91d78802662a5d10b77684c5324962ea1 (patch)
treebd7fa1e9b36385e1f2d778b105a95b18ae27432c
parentc3902f988783eb45c9ef23db566cf7dbbb6fdf3d (diff)
gui: Fix error in Restore Versions when path exists as both directory and file (fixes #7068) (#8532)
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 <twilczynski@naver.com>
-rw-r--r--gui/default/syncthing/app.js2
1 files changed, 1 insertions, 1 deletions
diff --git a/gui/default/syncthing/app.js b/gui/default/syncthing/app.js
index 87e33dfc4f..94b4a5f619 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;