diff options
author | Dean Ferreyra <dean@octw.com> | 2020-09-05 02:54:49 +0300 |
---|---|---|
committer | Dean Ferreyra <dean@octw.com> | 2020-09-05 02:54:49 +0300 |
commit | 5436d16c20c969ae95a3006ec93a2e69837c6d36 (patch) | |
tree | 25554a972cfe07b295d8c56fe7752158d815c19e /Duplicati/Server | |
parent | 5c2fb96f5f45990a3552ddfc3a4c248aecbeabec (diff) |
Fix restore GUI for filters with wildcard characters
In RestoreController.js, remove the branch on whether the path
contains wildcard characters and instead use code that works for all
cases.
Diffstat (limited to 'Duplicati/Server')
-rw-r--r-- | Duplicati/Server/webroot/ngax/scripts/controllers/RestoreController.js | 33 |
1 files changed, 14 insertions, 19 deletions
diff --git a/Duplicati/Server/webroot/ngax/scripts/controllers/RestoreController.js b/Duplicati/Server/webroot/ngax/scripts/controllers/RestoreController.js index 549b5451b..346c64fdf 100644 --- a/Duplicati/Server/webroot/ngax/scripts/controllers/RestoreController.js +++ b/Duplicati/Server/webroot/ngax/scripts/controllers/RestoreController.js @@ -346,26 +346,21 @@ backupApp.controller('RestoreController', function ($rootScope, $scope, $routePa var paths = []; for(var n in $scope.Selected) { var item = $scope.Selected[n]; - if (item.indexOf('*') >= 0 || item.indexOf('?') >= 0) { - // Handle paths with literal wildcard characters - // specially - if (item.substr(item.length - 1) == dirsep) { - // Switch to a regular expression filter so we can - // preserve the literal wildcard characters and - // also support the equivalent of a globbing '*' - // suffix. - - // Escape regular expression metacharacters - var itemRegex = item.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'); - paths.push('[' + itemRegex + '.*]'); - } else { - paths.push('@' + item); - } + if (item.substr(item.length - 1) == dirsep) { + // To support the possibility of encountering paths + // with literal wildcard characters, but also being + // able to add the globbing "*" suffix, use a regular + // expression filter + + // Escape regular expression metacharacters + var itemRegex = item.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'); + // Add "globbing" suffix + paths.push('[' + itemRegex + '.*]'); } else { - if (item.substr(item.length - 1) == dirsep) - paths.push(item + '*'); - else - paths.push(item); + // To support the possibility of encountering paths + // with literal wildcard characters, create a literal + // filter + paths.push('@' + item); } } |