Skip to content

Commit 9e9070f

Browse files
author
Artem
committed
fix auto update for all statics
convert buffer to json for build info
1 parent 5d2eba8 commit 9e9070f

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

redisinsight/api/src/modules/statics-management/providers/auto-updated-statics.provider.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ describe('AutoUpdatedStaticsProvider', () => {
179179
describe('getRemoteBuildInfo', () => {
180180
it('should return remote build info json', async () => {
181181
const mockRemoteBuildInfo = { timestamp: 1 };
182-
mockedAxios.get.mockResolvedValueOnce({ data: mockRemoteBuildInfo });
182+
mockedAxios.get.mockResolvedValueOnce({ data: Buffer.from(JSON.stringify(mockRemoteBuildInfo)) });
183183
expect(await service.getRemoteBuildInfo()).toEqual(mockRemoteBuildInfo);
184184
});
185185
it('should return empty object on fail', async () => {

redisinsight/api/src/modules/statics-management/providers/auto-updated-statics.provider.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,8 @@ export class AutoUpdatedStaticsProvider implements OnModuleInit {
104104
*/
105105
async getRemoteBuildInfo(): Promise<Record<string, any>> {
106106
try {
107-
return await getFile(new URL(join(this.options.updateUrl, this.options.buildInfo)).toString());
107+
const buildInfoBuffer = await getFile(new URL(join(this.options.updateUrl, this.options.buildInfo)).toString());
108+
return JSON.parse(buildInfoBuffer.toString());
108109
} catch (e) {
109110
this.logger.warn('Unable to get remote build info', e);
110111
return {};

0 commit comments

Comments
 (0)