diff --git a/lib/workers/repository/update/pr/body/index.spec.ts b/lib/workers/repository/update/pr/body/index.spec.ts index 82ba5661993d988bac41d130ece453d2951b0e07..91733d1e9fa1e27beee9dd56522ca2c72a014c07 100644 --- a/lib/workers/repository/update/pr/body/index.spec.ts +++ b/lib/workers/repository/update/pr/body/index.spec.ts @@ -101,7 +101,7 @@ describe('workers/repository/update/pr/body/index', () => { dependencyUrl: 'https://github.com/foo/bar', homepage: 'https://example.com', references: - '[homepage](https://example.com), [source](https://github.com/foo/bar.git/tree/HEAD//baz), [changelog](https://raw.githubusercontent.com/foo/bar/tree/main/CHANGELOG.md)', + '[homepage](https://example.com), [source](https://github.com/foo/bar.git/tree/HEAD/baz), [changelog](https://raw.githubusercontent.com/foo/bar/tree/main/CHANGELOG.md)', sourceDirectory: '/baz', sourceUrl: 'https://github.com/foo/bar.git', }); diff --git a/lib/workers/repository/update/pr/body/index.ts b/lib/workers/repository/update/pr/body/index.ts index 2b344ed5a215966cdc3f4812a41c1c9a9a3ca8f7..13a3fe90f35d41e5f50dd24cd5b146a4e3c3be89 100644 --- a/lib/workers/repository/update/pr/body/index.ts +++ b/lib/workers/repository/update/pr/body/index.ts @@ -2,7 +2,7 @@ import { PrDebugData, platform } from '../../../../../modules/platform'; import { regEx } from '../../../../../util/regex'; import { toBase64 } from '../../../../../util/string'; import * as template from '../../../../../util/template'; -import { ensureTrailingSlash } from '../../../../../util/url'; +import { joinUrlParts } from '../../../../../util/url'; import type { BranchConfig } from '../../../../types'; import { getChangelogs } from './changelogs'; import { getPrConfigDescription } from './config-description'; @@ -45,10 +45,7 @@ function massageUpdateMetadata(config: BranchConfig): void { if (sourceUrl) { let fullUrl = sourceUrl; if (sourceDirectory) { - fullUrl = - ensureTrailingSlash(sourceUrl) + - 'tree/HEAD/' + - sourceDirectory.replace('^/?/', ''); + fullUrl = joinUrlParts(sourceUrl, 'tree/HEAD/', sourceDirectory); } references.push(`[source](${fullUrl})`); }