diff --git a/gui/default/syncthing/core/syncthingController.js b/gui/default/syncthing/core/syncthingController.js index 57309cee2..a7fe630b7 100644 --- a/gui/default/syncthing/core/syncthingController.js +++ b/gui/default/syncthing/core/syncthingController.js @@ -3308,14 +3308,12 @@ angular.module('syncthing.core') // Undefined or null should become a valid string. path = ''; } - var hash = path.indexOf('#'); - if (hash != -1) { - url += '/' + path.slice(0, hash); - url += '?version=' + $scope.versionBase(); - url += path.slice(hash); - } else { - url += '/' + path; - url += '?version=' + $scope.versionBase(); + var hashIndex = path.indexOf('#'); + url += '/' + (hashIndex === -1 ? path : path.slice(0, hashIndex)); + url += '?version=' + $scope.versionBase(); + var hash = hashIndex === -1 ? '' : path.slice(hashIndex); + if (hash) { + url += hash; } return url; };