diff --git a/lib/datasource/packagist/__snapshots__/index.spec.ts.snap b/lib/datasource/packagist/__snapshots__/index.spec.ts.snap index 87a2107f708b40..c34ca81ee0da8d 100644 --- a/lib/datasource/packagist/__snapshots__/index.spec.ts.snap +++ b/lib/datasource/packagist/__snapshots__/index.spec.ts.snap @@ -700,3 +700,33 @@ Array [ }, ] `; + +exports[`datasource/packagist/index getReleases supports providers without a hash 1`] = ` +Object { + "homepage": "https://wordpress.org/plugins/1beyt/", + "registryUrl": "https://composer.renovatebot.com", + "releases": Array [ + Object { + "gitRef": "1.0", + "version": "1.0", + }, + Object { + "gitRef": "1.1", + "version": "1.1", + }, + Object { + "gitRef": "1.4", + "version": "1.4", + }, + Object { + "gitRef": "1.5", + "version": "1.5", + }, + Object { + "gitRef": "1.5.1", + "version": "1.5.1", + }, + ], + "sourceUrl": "https://plugins.svn.wordpress.org/1beyt/", +} +`; diff --git a/lib/datasource/packagist/index.spec.ts b/lib/datasource/packagist/index.spec.ts index a4e083e2d71349..edf010c4c9f06b 100644 --- a/lib/datasource/packagist/index.spec.ts +++ b/lib/datasource/packagist/index.spec.ts @@ -305,6 +305,34 @@ describe('datasource/packagist/index', () => { expect(res).not.toBeNull(); expect(httpMock.getTrace()).toMatchSnapshot(); }); + it('supports providers without a hash', async () => { + const packagesJson = { + packages: [], + 'providers-url': '/p/%package%.json', + providers: { + 'wpackagist-plugin/1337-rss-feed-made-for-sharing': { + sha256: null, + }, + 'wpackagist-plugin/1beyt': { + sha256: null, + }, + }, + }; + httpMock + .scope('https://composer.renovatebot.com') + .get('/packages.json') + .reply(200, packagesJson) + .get('/p/wpackagist-plugin/1beyt.json') + .reply(200, beytJson); + const res = await getPkgReleases({ + ...config, + datasource, + versioning, + depName: 'wpackagist-plugin/1beyt', + }); + expect(res).toMatchSnapshot(); + expect(res).not.toBeNull(); + }); it('handles providers miss', async () => { const packagesJson = { packages: [], diff --git a/lib/datasource/packagist/index.ts b/lib/datasource/packagist/index.ts index c515e1c01cae63..605662dcc3efa4 100644 --- a/lib/datasource/packagist/index.ts +++ b/lib/datasource/packagist/index.ts @@ -238,7 +238,7 @@ async function packageLookup( return includesPackages[name]; } let pkgUrl; - if (providerPackages?.[name]) { + if (name in providerPackages) { pkgUrl = URL.resolve( regUrl, providersUrl