From ade8d79d424357f976dff7646742208c59f58cb9 Mon Sep 17 00:00:00 2001 From: Quentin Hibon Date: Wed, 3 Feb 2021 20:58:24 +0100 Subject: [PATCH] gui: Do not touch .stignore when not needed (fixes #7284) (#7325) --- gui/default/syncthing/core/syncthingController.js | 6 +++++- gui/default/untrusted/syncthing/core/syncthingController.js | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/gui/default/syncthing/core/syncthingController.js b/gui/default/syncthing/core/syncthingController.js index 8ae34393a..23d73a4f9 100755 --- a/gui/default/syncthing/core/syncthingController.js +++ b/gui/default/syncthing/core/syncthingController.js @@ -2019,7 +2019,11 @@ angular.module('syncthing.core') $scope.folders[folderCfg.id] = folderCfg; $scope.config.folders = folderList($scope.folders); - if (ignoresLoaded && $scope.editingExisting && ignores !== folderCfg.ignores) { + function arrayEquals(a, b) { + return a.length === b.length && a.every(function(v, i) { return v === b[i] }); + } + + if (ignoresLoaded && $scope.editingExisting && !arrayEquals(ignores, folderCfg.ignores)) { saveIgnores(ignores); }; diff --git a/gui/default/untrusted/syncthing/core/syncthingController.js b/gui/default/untrusted/syncthing/core/syncthingController.js index 479198654..418ffe306 100755 --- a/gui/default/untrusted/syncthing/core/syncthingController.js +++ b/gui/default/untrusted/syncthing/core/syncthingController.js @@ -2037,7 +2037,11 @@ angular.module('syncthing.core') $scope.folders[folderCfg.id] = folderCfg; $scope.config.folders = folderList($scope.folders); - if (ignoresLoaded && $scope.editingExisting && ignores !== folderCfg.ignores) { + function arrayEquals(a, b) { + return a.length === b.length && a.every(function(v, i) { return v === b[i] }); + } + + if (ignoresLoaded && $scope.editingExisting && !arrayEquals(ignores, folderCfg.ignores)) { saveIgnores(ignores); };