diff options
author | tomasz1986 <twilczynski@naver.com> | 2023-08-01 14:20:01 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-08-01 14:20:01 +0200 |
commit | 53239281593cba4192d592ac694958876a184d84 (patch) | |
tree | c4cd01e64e4ce68102ad0842b3d5e1b534cda9fb | |
parent | 97625ccc26d0919f709acc8e4b1211b485e722aa (diff) | |
download | syncthing-53239281593cba4192d592ac694958876a184d84.tar.gz syncthing-53239281593cba4192d592ac694958876a184d84.zip |
gui: Use case-insensive and backslash-agnostic versions filter (fixes #7973) (#8995)
Currently, the versions filter is case-sensitive regardless of the
underlying OS. With this change, the filter becomes case-insensitive
everywhere, which is more user-friendly and makes it easier to search
for files whose exact case the user may not remember.
In addition, forward and backslashes are no longer distinguished,
whether used as path separators or as part of a file / directory
name (which is unlikely but possible on some platforms).
Signed-off-by: Tomasz WilczyĆski <twilczynski@naver.com>
-rwxr-xr-x | gui/default/syncthing/core/syncthingController.js | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/gui/default/syncthing/core/syncthingController.js b/gui/default/syncthing/core/syncthingController.js index adca42026..4163d020a 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; } |