mirror of
https://github.com/renovatebot/renovate.git
synced 2025-01-11 22:46:27 +00:00
fix(maven): Catch and log URL construction errors (#4572)
This commit is contained in:
parent
ecdb9b3c3b
commit
e67523e152
2 changed files with 22 additions and 5 deletions
|
@ -91,10 +91,19 @@ async function downloadMavenXml(
|
|||
repoUrl: string,
|
||||
dependencyFilePath: string
|
||||
): Promise<XmlDocument | null> {
|
||||
const pkgUrl = new url.URL(
|
||||
`${dependency.dependencyUrl}/${dependencyFilePath}`,
|
||||
repoUrl
|
||||
);
|
||||
let pkgUrl;
|
||||
try {
|
||||
pkgUrl = new url.URL(
|
||||
`${dependency.dependencyUrl}/${dependencyFilePath}`,
|
||||
repoUrl
|
||||
);
|
||||
} catch (err) {
|
||||
logger.debug(
|
||||
{ err, dependency, repoUrl, dependencyFilePath },
|
||||
`Error constructing URL for ${dependency.display}`
|
||||
);
|
||||
return null;
|
||||
}
|
||||
|
||||
let rawContent: string;
|
||||
switch (pkgUrl.protocol) {
|
||||
|
|
|
@ -215,7 +215,15 @@ describe('datasource/maven', () => {
|
|||
});
|
||||
expect(releases).toBeNull();
|
||||
});
|
||||
|
||||
it('should return null for invalid registryUrls', async () => {
|
||||
const releases = await datasource.getPkgReleases({
|
||||
...config,
|
||||
lookupName: 'mysql:mysql-connector-java',
|
||||
// eslint-disable-next-line no-template-curly-in-string
|
||||
registryUrls: ['${project.baseUri}../../repository/'],
|
||||
});
|
||||
expect(releases).toBeNull();
|
||||
});
|
||||
it('should support scm.url values prefixed with "scm:"', async () => {
|
||||
const releases = await datasource.getPkgReleases({
|
||||
...config,
|
||||
|
|
Loading…
Reference in a new issue