mirror of
https://github.com/renovatebot/renovate.git
synced 2025-01-12 15:06:27 +00:00
fix: check returned pypi name against requested name
This commit is contained in:
parent
db38553d05
commit
9153e3905f
2 changed files with 19 additions and 0 deletions
|
@ -17,6 +17,13 @@ async function getDependency(purl) {
|
||||||
logger.debug({ depName }, 'pip package not found');
|
logger.debug({ depName }, 'pip package not found');
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
if (!(dep.info && dep.info.name === depName)) {
|
||||||
|
logger.warn(
|
||||||
|
{ lookupName: depName, returnedName: dep.name },
|
||||||
|
'Returned name does not match with requested name'
|
||||||
|
);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
if (dep.info && dep.info.home_page) {
|
if (dep.info && dep.info.home_page) {
|
||||||
if (dep.info.home_page.startsWith('https://github.com')) {
|
if (dep.info.home_page.startsWith('https://github.com')) {
|
||||||
dependency.repositoryUrl = dep.info.home_page;
|
dependency.repositoryUrl = dep.info.home_page;
|
||||||
|
|
|
@ -30,6 +30,7 @@ describe('datasource/pypi', () => {
|
||||||
got.mockReturnValueOnce({
|
got.mockReturnValueOnce({
|
||||||
body: {
|
body: {
|
||||||
info: {
|
info: {
|
||||||
|
name: 'something',
|
||||||
home_page: 'https://microsoft.com',
|
home_page: 'https://microsoft.com',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -38,5 +39,16 @@ describe('datasource/pypi', () => {
|
||||||
await datasource.getDependency('pkg:pypi/something')
|
await datasource.getDependency('pkg:pypi/something')
|
||||||
).toMatchSnapshot();
|
).toMatchSnapshot();
|
||||||
});
|
});
|
||||||
|
it('returns null if mismatched name', async () => {
|
||||||
|
got.mockReturnValueOnce({
|
||||||
|
body: {
|
||||||
|
info: {
|
||||||
|
name: 'something-else',
|
||||||
|
home_page: 'https://microsoft.com',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
||||||
|
expect(await datasource.getDependency('pkg:pypi/something')).toBeNull();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue