mirror of
https://github.com/syncthing/syncthing.git
synced 2024-11-15 09:58:57 -07:00
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.
This commit is contained in:
parent
9adb239662
commit
44fef31780
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user