From 77578e8aac65c0660d98ad7c4f65b020718cb7c2 Mon Sep 17 00:00:00 2001 From: Simon Frei Date: Thu, 10 Aug 2017 15:31:25 +0000 Subject: [PATCH] gui: Don't set default path editing existing folders without label (fixes #4297) GitHub-Pull-Request: https://github.com/syncthing/syncthing/pull/4298 LGTM: calmh --- gui/default/syncthing/core/syncthingController.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/gui/default/syncthing/core/syncthingController.js b/gui/default/syncthing/core/syncthingController.js index 0e314acb4..db2eb72d0 100755 --- a/gui/default/syncthing/core/syncthingController.js +++ b/gui/default/syncthing/core/syncthingController.js @@ -622,6 +622,10 @@ angular.module('syncthing.core') return path; } + function shouldSetDefaultFolderPath() { + return $scope.config.options && $scope.config.options.defaultFolderPath && !$scope.editingExisting && $scope.folderEditor.folderPath.$pristine + } + $scope.neededPageChanged = function (page) { $scope.neededCurrentPage = page; refreshNeed($scope.neededFolder); @@ -1388,14 +1392,14 @@ angular.module('syncthing.core') }); $scope.$watch('currentFolder.label', function (newvalue) { - if (!$scope.config.options || !$scope.config.options.defaultFolderPath || $scope.editingExisting || !$scope.folderEditor.folderPath.$pristine || !newvalue) { + if (!newvalue || !shouldSetDefaultFolderPath()) { return; } $scope.currentFolder.path = pathJoin($scope.config.options.defaultFolderPath, newvalue); }); $scope.$watch('currentFolder.id', function (newvalue) { - if (!$scope.config.options || !$scope.config.options.defaultFolderPath || !$scope.folderEditor.folderPath.$pristine || !newvalue || $scope.currentFolder.label) { + if (!newvalue || !shouldSetDefaultFolderPath() || $scope.currentFolder.label) { return; } $scope.currentFolder.path = pathJoin($scope.config.options.defaultFolderPath, newvalue);