From 38636cee04d81c164329aec7e8bbde0794df3f22 Mon Sep 17 00:00:00 2001 From: Tobias Date: Thu, 21 Nov 2024 17:30:18 +0100 Subject: [PATCH] fix(datasource/maven): make cache key extractedVersion specific (#32658) --- lib/modules/datasource/maven/index.spec.ts | 15 +++++++++++++++ lib/modules/datasource/maven/index.ts | 2 +- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/lib/modules/datasource/maven/index.spec.ts b/lib/modules/datasource/maven/index.spec.ts index eec203b2520c78..757e328764afa2 100644 --- a/lib/modules/datasource/maven/index.spec.ts +++ b/lib/modules/datasource/maven/index.spec.ts @@ -711,6 +711,21 @@ describe('modules/datasource/maven/index', () => { expect(res).toBe(releaseOrig); }); + it('returns original value for 200 response with versionOrig', async () => { + httpMock + .scope(MAVEN_REPO) + .head('/foo/bar/1.2.3/bar-1.2.3.pom') + .reply(200); + const releaseOrig: Release = { version: '1.2', versionOrig: '1.2.3' }; + + const res = await postprocessRelease( + { datasource, packageName: 'foo:bar', registryUrl: MAVEN_REPO }, + releaseOrig, + ); + + expect(res).toBe(releaseOrig); + }); + it('returns original value for invalid configs', async () => { const releaseOrig: Release = { version: '1.2.3' }; expect( diff --git a/lib/modules/datasource/maven/index.ts b/lib/modules/datasource/maven/index.ts index 8fd08b788131ab..aae05ab640bf48 100644 --- a/lib/modules/datasource/maven/index.ts +++ b/lib/modules/datasource/maven/index.ts @@ -254,7 +254,7 @@ export class MavenDatasource extends Datasource { { registryUrl, packageName }: PostprocessReleaseConfig, { version, versionOrig }: Release, ) => - `postprocessRelease:${registryUrl}:${packageName}:${versionOrig ?? version}`, + `postprocessRelease:${registryUrl}:${packageName}:${versionOrig ? `${versionOrig}:${version}` : `${version}`}`, ttlMinutes: 24 * 60, }) override async postprocessRelease(