Repository: syncthing/syncthing (language: go)

Issue:
Restore versions file filter should be case insensitive
Currently, the filter is case **sensitive**.

![image](https://user-images.githubusercontent.com/5626656/134810112-09c8df4b-9af1-4988-a005-f06d6f2639b5.png)

I'd argue that there should be an option to make it case insensitive (perhaps in a form of a checkbox). Alternatively, the filter could automatically adapt to the operating system at hand (e.g. as the ignore patterns do, being case insensitive on Windows).


Discussion / hints:

Fix patch:
diff --git a/gui/default/syncthing/core/syncthingController.js b/gui/default/syncthing/core/syncthingController.js
index adca420264d..4163d020ab4 100755
--- a/gui/default/syncthing/core/syncthingController.js
+++ b/gui/default/syncthing/core/syncthingController.js
@@ -2778,9 +2778,17 @@ angular.module('syncthing.core')
 
             $scope.restoreVersions.tree.filterNodes(function (node) {
                 if (node.folder) return false;
-                if ($scope.restoreVersions.filters.text && node.key.indexOf($scope.restoreVersions.filters.text) < 0) {
-                    return false;
+
+                if ($scope.restoreVersions.filters.text) {
+                    // Use case-insensitive filter and convert backslashes to
+                    // forward slashes to allow using them as path separators.
+                    var filterText = $scope.restoreVersions.filters.text.toLowerCase().replace(/\\/g, '/');
+                    var versionPath = node.key.toLowerCase().replace(/\\/g, '/');
+                    if (versionPath.indexOf(filterText) < 0) {
+                        return false;
+                    }
                 }
+
                 if ($scope.restoreVersions.filterVersions(node.data.versions).length == 0) {
                     return false;
                 }


Test patch: