Skip to content

Commit 622f50d

Browse files
committed
fix: use & pass down opts for getCustom in imageAnalysis
1 parent 60c5f9d commit 622f50d

File tree

4 files changed

+147
-119
lines changed

4 files changed

+147
-119
lines changed

src/analysis.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,8 +156,8 @@ async function requestComponent(provider, manifest, url, opts = {}) {
156156
async function requestImages(imageRefs, url, html = false, opts = {}) {
157157
const imageSboms = {}
158158
for (const image of imageRefs) {
159-
const parsedImageRef = parseImageRef(image)
160-
imageSboms[parsedImageRef.getPackageURL().toString()] = generateImageSBOM(parsedImageRef)
159+
const parsedImageRef = parseImageRef(image, opts)
160+
imageSboms[parsedImageRef.getPackageURL().toString()] = generateImageSBOM(parsedImageRef, opts)
161161
}
162162

163163
const finalUrl = new URL(`${url}/api/v4/batch-analysis`);

src/oci_image/images.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -216,32 +216,33 @@ export class ImageRef {
216216
/**
217217
* @param {string} image
218218
* @param {string} [platform]
219+
* @param {import("index.js").Options} [opts={}]
219220
*/
220-
constructor(image, platform) {
221+
constructor(image, platform, opts) {
221222
this.image = new Image(image);
222223

223224
if (platform != null) {
224225
this.platform = Platform.fromString(platform);
225226
}
226227

227-
this.checkImageDigest();
228+
this.checkImageDigest(opts);
228229
}
229230

230231
/**
231232
* @private
232233
*/
233-
checkImageDigest() {
234+
checkImageDigest(opts) {
234235
if (this.image.digest == null) {
235236
try {
236-
const digests = getImageDigests(this);
237+
const digests = getImageDigests(this, opts);
237238
if (digests.size === 0) {
238239
throw new Error("Failed to get any image digest");
239240
}
240241
if (digests.size === 1 && digests[Platform.EMPTY.toString()]) {
241242
this.image.digest = digests[Platform.EMPTY.toString()];
242243
} else {
243244
if (this.platform == null) {
244-
this.platform = getImagePlatform();
245+
this.platform = getImagePlatform(opts);
245246
}
246247
if (this.platform == null) {
247248
throw new Error(`Failed to get image platform for image digest`);

0 commit comments

Comments
 (0)