gui: Parse strings before copying options object (fixes #5824) (#5922)

This commit is contained in:
Simon Frei 2019-08-02 12:46:27 +02:00 committed by Jakob Borg
parent 77cc87dfca
commit 1475c0344a
1 changed files with 7 additions and 6 deletions

View File

@ -1279,6 +1279,13 @@ angular.module('syncthing.core')
$scope.protocolChanged = true;
}
// Parse strings to arrays before copying over
['listenAddresses', 'globalAnnounceServers'].forEach(function (key) {
$scope.tmpOptions[key] = $scope.tmpOptions["_" + key + "Str"].split(/[ ,]+/).map(function (x) {
return x.trim();
});
});
// Apply new settings locally
$scope.thisDeviceIn($scope.tmpDevices).name = $scope.tmpOptions.deviceName;
$scope.config.options = angular.copy($scope.tmpOptions);
@ -1292,12 +1299,6 @@ angular.module('syncthing.core')
// here as well...
$scope.devices = $scope.config.devices;
['listenAddresses', 'globalAnnounceServers'].forEach(function (key) {
$scope.config.options[key] = $scope.config.options["_" + key + "Str"].split(/[ ,]+/).map(function (x) {
return x.trim();
});
});
$scope.saveConfig(function () {
if (themeChanged) {
document.location.reload(true);