From ccd57ca7c2d00ec43eb199f452ddf5a1b42b5188 Mon Sep 17 00:00:00 2001 From: Federico Rodriguez Date: Fri, 28 Oct 2022 11:16:57 +0200 Subject: [PATCH] Fix logo image cache on upload --- common/constants.ts | 6 +++--- server/controllers/wazuh-utils/wazuh-utils.ts | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/common/constants.ts b/common/constants.ts index 494e242e1b..1564c7ef57 100644 --- a/common/constants.ts +++ b/common/constants.ts @@ -948,7 +948,7 @@ export const PLUGIN_SETTINGS: { [key: string]: TPluginSetting } = { store: { relativePathFileSystem: 'public/assets/custom/images', filename: 'customization.logo.app', - resolveStaticURL: (filename: string) => `custom/images/${filename}` + resolveStaticURL: (filename: string) => `custom/images/${filename}?v=${Date.now()}` } } }, @@ -984,7 +984,7 @@ export const PLUGIN_SETTINGS: { [key: string]: TPluginSetting } = { store: { relativePathFileSystem: 'public/assets/custom/images', filename: 'customization.logo.healthcheck', - resolveStaticURL: (filename: string) => `custom/images/${filename}` + resolveStaticURL: (filename: string) => `custom/images/${filename}?v=${Date.now()}` } } }, @@ -1058,7 +1058,7 @@ export const PLUGIN_SETTINGS: { [key: string]: TPluginSetting } = { store: { relativePathFileSystem: 'public/assets/custom/images', filename: 'customization.logo.sidebar', - resolveStaticURL: (filename: string) => `custom/images/${filename}` + resolveStaticURL: (filename: string) => `custom/images/${filename}?v=${Date.now()}` } } }, diff --git a/server/controllers/wazuh-utils/wazuh-utils.ts b/server/controllers/wazuh-utils/wazuh-utils.ts index 59f5ffe81d..05ea874af8 100644 --- a/server/controllers/wazuh-utils/wazuh-utils.ts +++ b/server/controllers/wazuh-utils/wazuh-utils.ts @@ -100,7 +100,7 @@ export class WazuhUtilsCtrl { /** * Returns Wazuh app logs - * @param {Object} context + * @param {Object} context * @param {Object} request * @param {Object} response * @returns {Array} app logs or ErrorResponse @@ -164,7 +164,7 @@ export class WazuhUtilsCtrl { // Update the setting in the configuration cache const pluginSettingValue = pluginSetting.options.file.store.resolveStaticURL(fileNamePath); - await updateConfigurationFile.updateConfiguration({[key]: pluginSettingValue}); + await updateConfigurationFile.updateConfiguration({[key]: pluginSettingValue}); return response.ok({ body: { @@ -201,7 +201,7 @@ export class WazuhUtilsCtrl { // Update the setting in the configuration cache const pluginSettingValue = pluginSetting.defaultValue; - await updateConfigurationFile.updateConfiguration({[key]: pluginSettingValue}); + await updateConfigurationFile.updateConfiguration({[key]: pluginSettingValue}); return response.ok({ body: { @@ -219,7 +219,7 @@ export class WazuhUtilsCtrl { }, 3023 ) - + private routeDecoratorProtectedAdministratorRoleValidToken(routeHandler, errorCode: number){ return async (context, request, response) => { try{