From b39985483dffd352e1606d9551995234a67ebf51 Mon Sep 17 00:00:00 2001 From: tomasz1986 Date: Tue, 27 Sep 2022 19:57:48 +0200 Subject: [PATCH] gui: Filter scope ID out of IPv6 addresses in Remote GUI (fixes #8084) (#8559) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Currently, the link to remote GUI uses device addresses as they are advertised from the router. Because of this, they may end up having a scope ID attached to them. The problem is that browsers do not support such addresses, leaving the user with a non-working URL. Because of the above, use regex to simply filter out the scope ID from the address before using it for Remote GUI. Signed-off-by: Tomasz WilczyƄski --- gui/default/syncthing/core/syncthingController.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/gui/default/syncthing/core/syncthingController.js b/gui/default/syncthing/core/syncthingController.js index 8b998a142..de5d32659 100755 --- a/gui/default/syncthing/core/syncthingController.js +++ b/gui/default/syncthing/core/syncthingController.js @@ -1202,7 +1202,8 @@ angular.module('syncthing.core') $scope.remoteGUIAddress = function (deviceCfg) { // Assume hasRemoteGUIAddress is true or we would not be here var conn = $scope.connections[deviceCfg.deviceID]; - return 'http://' + replaceAddressPort(conn.address, deviceCfg.remoteGUIPort); + // Use regex to filter out scope ID from IPv6 addresses. + return 'http://' + replaceAddressPort(conn.address, deviceCfg.remoteGUIPort).replace('%.*?\]:', ']:'); }; function replaceAddressPort(address, newPort) {