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(