From 7cb61dcceb72ebba3e2145a60d399c88ce060217 Mon Sep 17 00:00:00 2001 From: Jaspar S Date: Thu, 9 Jun 2022 12:42:11 +0200 Subject: [PATCH] Fix: Introduce new function to remove leading zero fron version for correct links to GSM-Manual (#3460) --- src/gmp/gmpsettings.js | 4 ++-- src/version.js | 7 +++++++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/gmp/gmpsettings.js b/src/gmp/gmpsettings.js index d19cb03c4e..44c4642bcb 100644 --- a/src/gmp/gmpsettings.js +++ b/src/gmp/gmpsettings.js @@ -16,14 +16,14 @@ * along with this program. If not, see . */ -import {RELEASE_VERSION} from '../version'; +import {RELEASE_VERSION, REMOVED_ZERO_RELEASE_VERSION} from '../version'; import {isDefined} from './utils/identity'; export const DEFAULT_RELOAD_INTERVAL = 15 * 1000; // fifteen seconds export const DEFAULT_RELOAD_INTERVAL_ACTIVE = 3 * 1000; // three seconds export const DEFAULT_RELOAD_INTERVAL_INACTIVE = 60 * 1000; // one minute -export const DEFAULT_MANUAL_URL = `http://docs.greenbone.net/GSM-Manual/gos-${RELEASE_VERSION}/`; +export const DEFAULT_MANUAL_URL = `http://docs.greenbone.net/GSM-Manual/gos-${REMOVED_ZERO_RELEASE_VERSION}/`; export const DEFAULT_PROTOCOLDOC_URL = `https://docs.greenbone.net/API/GMP/gmp-${RELEASE_VERSION}.html`; export const DEFAULT_REPORT_RESULTS_THRESHOLD = 25000; export const DEFAULT_LOG_LEVEL = 'warn'; diff --git a/src/version.js b/src/version.js index 32762f4083..95c75d24da 100644 --- a/src/version.js +++ b/src/version.js @@ -22,8 +22,15 @@ const getMajorMinorVersion = () => { return `${major}.${minor}`; }; +const getCleanedMajorMinorVersion = () => { + // eslint-disable-next-line no-unused-vars + const [major, minor, ...rest] = VERSION.split('.'); + return `${major}.${parseInt(minor)}`; +}; + export const VERSION = '22.04.0.dev1'; export const RELEASE_VERSION = getMajorMinorVersion(); +export const REMOVED_ZERO_RELEASE_VERSION = getCleanedMajorMinorVersion(); export default VERSION;