Repository: syncthing/syncthing (language: go)

Issue:
"Restore Versions" GUI breaks when path exists as both directory and file
In the latest version of syncthing, if `.stversions` contains both a non-empty directory and a backup for a file with the same name, for example:

```
.stversions/foo
└── bar~20201029-000000
.stversions/foo~20201029-000000
```

then the GUI's "Restore Versions" interface doesn't display any files, with an error in the console coming from the `buildTree` function in `app.js` about `parent.children` being `undefined`.


Discussion / hints:

Fix patch:
diff --git a/gui/default/syncthing/app.js b/gui/default/syncthing/app.js
index 87e33dfc4f6..94b4a5f619a 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;


Test patch: