Skip to content

Commit

Permalink
feat(maven): Fetch "last-modified" timestamps from all hosts (#9795)
Browse files Browse the repository at this point in the history
  • Loading branch information
zharinov committed Apr 30, 2021
1 parent 7f7b796 commit bc25520
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
2 changes: 2 additions & 0 deletions lib/datasource/maven/__snapshots__/index.spec.ts.snap
Expand Up @@ -558,9 +558,11 @@ Object {
"registryUrl": "https://custom.registry.renovatebot.com",
"releases": Array [
Object {
"releaseTimestamp": "2020-01-01T01:00:00.000Z",
"version": "1.0.0",
},
Object {
"releaseTimestamp": "2020-01-01T02:00:00.000Z",
"version": "2.0.0",
},
],
Expand Down
8 changes: 2 additions & 6 deletions lib/datasource/maven/util.ts
Expand Up @@ -115,12 +115,8 @@ export async function isHttpResourceExists(
try {
const httpClient = httpByHostType(hostType);
const res = await httpClient.head(pkgUrl.toString());
const pkgUrlHost = url.parse(pkgUrl.toString()).host;
if (['repo.maven.apache.org', 'gitlab.com'].includes(pkgUrlHost)) {
const timestamp = res?.headers?.['last-modified'] as string;
return timestamp || true;
}
return true;
const timestamp = res?.headers?.['last-modified'] as string;
return timestamp || true;
} catch (err) {
if (isNotFoundError(err)) {
return false;
Expand Down

0 comments on commit bc25520

Please sign in to comment.