Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/duplicati/duplicati.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDean Ferreyra <dean@octw.com>2020-09-04 08:59:24 +0300
committerDean Ferreyra <dean@octw.com>2020-09-04 08:59:24 +0300
commitff91c47f68622f0efe44328eacf7afae9ff6c615 (patch)
treef498fdab027c7cbf5605beb31b3e936ed4ba7340 /Duplicati/Server
parentb8501dfd77f20400df827b20381d94f5e6c205bc (diff)
Fix restore GUI for filters with wildcard characters
Change RestoreController.js to handle the case where the selected restore paths contain literal wildcard characters. For files, prefix with `@`. For directories, convert to regular expression filters so that we can preserve the literal wildcard characters and also support the equivalent of a globbing `*` suffix.
Diffstat (limited to 'Duplicati/Server')
-rw-r--r--Duplicati/Server/webroot/ngax/scripts/controllers/RestoreController.js25
1 files changed, 21 insertions, 4 deletions
diff --git a/Duplicati/Server/webroot/ngax/scripts/controllers/RestoreController.js b/Duplicati/Server/webroot/ngax/scripts/controllers/RestoreController.js
index 0ff98a378..650d414fa 100644
--- a/Duplicati/Server/webroot/ngax/scripts/controllers/RestoreController.js
+++ b/Duplicati/Server/webroot/ngax/scripts/controllers/RestoreController.js
@@ -346,10 +346,27 @@ backupApp.controller('RestoreController', function ($rootScope, $scope, $routePa
var paths = [];
for(var n in $scope.Selected) {
var item = $scope.Selected[n];
- if (item.substr(item.length - 1) == dirsep)
- paths.push(item + '*');
- else
- paths.push(item);
+ if (item.indexOf('*') >= 0 || item.indexOf('?')) {
+ // 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);
+ }
+ } else {
+ if (item.substr(item.length - 1) == dirsep)
+ paths.push(item + '*');
+ else
+ paths.push(item);
+ }
}
if (paths.length > 0)