From 8fe4c49ce696aebde7e71b4d2d4dfc4ac4c31cb8 Mon Sep 17 00:00:00 2001 From: gpatel-fr <44170243+gpatel-fr@users.noreply.github.com> Date: Sat, 23 Dec 2023 14:26:56 +0100 Subject: [PATCH] a small fix and a few additional comments for PR 4962 (#5077) --- .../webroot/ngax/scripts/directives/parseFilterType.js | 6 ++++-- Duplicati/Server/webroot/ngax/scripts/services/AppUtils.js | 3 ++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/Duplicati/Server/webroot/ngax/scripts/directives/parseFilterType.js b/Duplicati/Server/webroot/ngax/scripts/directives/parseFilterType.js index 90aee7227..ea643e57e 100644 --- a/Duplicati/Server/webroot/ngax/scripts/directives/parseFilterType.js +++ b/Duplicati/Server/webroot/ngax/scripts/directives/parseFilterType.js @@ -6,6 +6,8 @@ backupApp.directive('parseFilterType', function(AppUtils, SystemInfo) { ctrl[0].$parsers.push(function(txt) { var dirsep = SystemInfo.state.DirectorySeparator || '/'; // Store type in scope for parseFilterContent directive + // This is necessary when changing directly the content (for example + // adding a '/' at the body end and then changing the filter type) // This works because ng-repeat creates a child scope for each iteration // It is still glitchy in some edge cases, but should be more consistent scope.filterType = txt; @@ -34,7 +36,7 @@ backupApp.directive('parseFilterContent', function(AppUtils, SystemInfo) { link: function(scope, element, attr, ctrl) { ctrl[0].$parsers.push(function(txt) { var dirsep = SystemInfo.state.DirectorySeparator || '/'; - // Store type in scope for parseFilterType directive + // Store content in scope for parseFilterType directive scope.filterBody = txt; return AppUtils.buildFilter(scope.filterType, txt, dirsep); }); @@ -44,7 +46,7 @@ backupApp.directive('parseFilterContent', function(AppUtils, SystemInfo) { // Remove double trailing slashes var parts = AppUtils.splitFilterIntoTypeAndBody(src, dirsep); if (parts == null) { - type = null; + scope.filterType = null; return null; } diff --git a/Duplicati/Server/webroot/ngax/scripts/services/AppUtils.js b/Duplicati/Server/webroot/ngax/scripts/services/AppUtils.js index 616d128a5..ed76c72a1 100644 --- a/Duplicati/Server/webroot/ngax/scripts/services/AppUtils.js +++ b/Duplicati/Server/webroot/ngax/scripts/services/AppUtils.js @@ -316,6 +316,7 @@ backupApp.service('AppUtils', function($rootScope, $timeout, $cookies, DialogSer return false; } else if (k == 'include' || k == 'exclude') { // Cannot specify filters in extra options + // Not sure that this is really called. DialogService.dialog(gettextCatalog.getString('Error'), gettextCatalog.getString('Cannot specify filter include or excludes in extra options')); return false; } @@ -659,7 +660,7 @@ backupApp.service('AppUtils', function($rootScope, $timeout, $cookies, DialogSer this.evalFilter = function(path, filters, include) { for (var i = 0; i < filters.length; i++) { var m = path.match(filters[i][1]); - // Regex such as .* might match empty string at the end which is unwanted + // Regex such as '.*' might match empty string at the end which is unwanted // Check that the first match covers the full string if (m && m.length >= 1 && m[0].length == path.length) return filters[i][0];