gui: Actually filter scope ID out of IPv6 address when using Remote GUI (ref #8084) (#9688)

gui: Actually filter scope ID out of IPv6 address when using Remote GUI
(ref #8084)

The current code does not work, because it uses a string in the
replace() method instead of regex. Thus, change it to a proper regex.

Signed-off-by: Tomasz Wilczyński <twilczynski@naver.com>
This commit is contained in:
tomasz1986 2024-09-08 12:42:32 +02:00 committed by GitHub
parent 563cec8923
commit 1baefea410
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1447,7 +1447,7 @@ angular.module('syncthing.core')
// Assume hasRemoteGUIAddress is true or we would not be here // Assume hasRemoteGUIAddress is true or we would not be here
var conn = $scope.connections[deviceCfg.deviceID]; var conn = $scope.connections[deviceCfg.deviceID];
// Use regex to filter out scope ID from IPv6 addresses. // Use regex to filter out scope ID from IPv6 addresses.
return 'http://' + replaceAddressPort(conn.address, deviceCfg.remoteGUIPort).replace('%.*?\]:', ']:'); return 'http://' + replaceAddressPort(conn.address, deviceCfg.remoteGUIPort).replace(/%.*?\]:/, ']:');
}; };
function replaceAddressPort(address, newPort) { function replaceAddressPort(address, newPort) {