Skip to content

Commit 5323928

Browse files
authored
gui: Use case-insensive and backslash-agnostic versions filter (fixes syncthing#7973) (syncthing#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 <[email protected]>
1 parent 97625cc commit 5323928

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

gui/default/syncthing/core/syncthingController.js

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2778,9 +2778,17 @@ angular.module('syncthing.core')
27782778

27792779
$scope.restoreVersions.tree.filterNodes(function (node) {
27802780
if (node.folder) return false;
2781-
if ($scope.restoreVersions.filters.text && node.key.indexOf($scope.restoreVersions.filters.text) < 0) {
2782-
return false;
2781+
2782+
if ($scope.restoreVersions.filters.text) {
2783+
// Use case-insensitive filter and convert backslashes to
2784+
// forward slashes to allow using them as path separators.
2785+
var filterText = $scope.restoreVersions.filters.text.toLowerCase().replace(/\\/g, '/');
2786+
var versionPath = node.key.toLowerCase().replace(/\\/g, '/');
2787+
if (versionPath.indexOf(filterText) < 0) {
2788+
return false;
2789+
}
27832790
}
2791+
27842792
if ($scope.restoreVersions.filterVersions(node.data.versions).length == 0) {
27852793
return false;
27862794
}

0 commit comments

Comments
 (0)