From 1475c0344ac9a7b26cfe6cb3ffe6f91bc606a559 Mon Sep 17 00:00:00 2001 From: Simon Frei Date: Fri, 2 Aug 2019 12:46:27 +0200 Subject: [PATCH] gui: Parse strings before copying options object (fixes #5824) (#5922) --- gui/default/syncthing/core/syncthingController.js | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/gui/default/syncthing/core/syncthingController.js b/gui/default/syncthing/core/syncthingController.js index c19b9f43..2fee612a 100755 --- a/gui/default/syncthing/core/syncthingController.js +++ b/gui/default/syncthing/core/syncthingController.js @@ -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);