From 44fef317800ce1d0795b4e2ebfbd5e9deda849ef Mon Sep 17 00:00:00 2001 From: Emil Lundberg Date: Sat, 21 Sep 2024 19:23:48 +0200 Subject: [PATCH] Don't require versionBase in docsURL In https://github.com/syncthing/syncthing/pull/9175 we will sometimes want to show links to the documentation on the login page. These links currently get truncated to just `https://docs.syncthing.net`, discarding the section path, because the server version is not yet known while on the login page. I don't think it's any worse to try to preserve the section path even without an explicit version tag, than to fall back to just the host and lose all context the link was attempting to provide. --- gui/default/syncthing/core/syncthingController.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/gui/default/syncthing/core/syncthingController.js b/gui/default/syncthing/core/syncthingController.js index a7fe630b7..9a5bc04a9 100644 --- a/gui/default/syncthing/core/syncthingController.js +++ b/gui/default/syncthing/core/syncthingController.js @@ -3301,16 +3301,16 @@ angular.module('syncthing.core') $scope.docsURL = function (path) { var url = 'https://docs.syncthing.net'; - if (!$scope.versionBase()) { - return url; - } if (!path) { // Undefined or null should become a valid string. path = ''; } var hashIndex = path.indexOf('#'); url += '/' + (hashIndex === -1 ? path : path.slice(0, hashIndex)); - url += '?version=' + $scope.versionBase(); + var ver = $scope.versionBase(); + if (ver) { + url += '?version=' + ver; + } var hash = hashIndex === -1 ? '' : path.slice(hashIndex); if (hash) { url += hash;