Skip to content

Commit

Permalink
fix(datasource/docker): handle empty newValue in getDigest (#33449)
Browse files Browse the repository at this point in the history
  • Loading branch information
viceice authored Jan 7, 2025
1 parent 19a99d2 commit 37c05dc
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
11 changes: 7 additions & 4 deletions lib/modules/datasource/docker/index.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,10 +98,13 @@ describe('modules/datasource/docker/index', () => {
.reply(200, { token: 'some-token' });

hostRules.find.mockReturnValue({});
const res = await getDigest({
datasource: 'docker',
packageName: 'some-dep',
});
const res = await getDigest(
{
datasource: 'docker',
packageName: 'some-dep',
},
'',
);
expect(res).toBe('some-digest');
});

Expand Down
2 changes: 1 addition & 1 deletion lib/modules/datasource/docker/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -831,7 +831,7 @@ export class DockerDatasource extends Datasource {
// TODO: types (#22198)
`getDigest(${registryHost}, ${dockerRepository}, ${newValue})`,
);
const newTag = newValue ?? 'latest';
const newTag = is.nonEmptyString(newValue) ? newValue : 'latest';
let digest: string | null = null;
try {
let architecture: string | null | undefined = null;
Expand Down

0 comments on commit 37c05dc

Please sign in to comment.