From 9adb2396624e21a82bf37ef702266bf759d089a1 Mon Sep 17 00:00:00 2001 From: Emil Lundberg Date: Sat, 21 Sep 2024 19:23:04 +0200 Subject: [PATCH] Linearize docsURL implementation --- gui/default/syncthing/core/syncthingController.js | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) 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; };