Skip to content
This repository was archived by the owner on Apr 3, 2024. It is now read-only.

Commit

Permalink
fix: do not modify image reference
Browse files Browse the repository at this point in the history
Previously we would default the image registry to `docker.io` if it was
not specified, but this is not correct in some instances. This code does
not have enough information to apply the defaults, so leave the values
as they are and let the scanner (which does have enough information to
make a proper decision) fill in the blanks.
  • Loading branch information
glb committed Jul 24, 2019
1 parent a740cb6 commit 9ec9721
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/__tests__/docker.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ describe("rename", () => {
name: "blank registry name",
imageName: "sample",
registryHost: "",
expected: "docker.io/sample:latest",
expected: "sample:latest",
},
];

Expand Down
8 changes: 6 additions & 2 deletions src/docker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,13 @@ export function parseReference(ref: string) {
}

function referenceToString(image: Image): string {
let fullName = image.domain || "docker.io";
let fullName;

fullName += "/" + image.path;
if (image.domain) {
fullName = image.domain + "/" + image.path;
} else {
fullName = image.path;
}

if (image.tag) {
fullName += ":" + image.tag;
Expand Down

0 comments on commit 9ec9721

Please sign in to comment.