snyk 1.1143.0 → 1.1144.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -157820,29 +157820,27 @@ async function extractImageContent(imageType, fileSystemPath, extractActions) {
157820
157820
  ]);
157821
157821
  let extractor;
157822
157822
  let archiveContent;
157823
- if (extractors.has(imageType)) {
157824
- extractor = extractors.get(imageType);
157823
+ if (!extractors.has(imageType)) {
157824
+ // default to Docker extractor if image type is unknown
157825
+ imageType = types_1.ImageType.DockerArchive;
157826
+ }
157827
+ extractor = extractors.get(imageType);
157828
+ try {
157825
157829
  archiveContent = await extractor.getLayersAndManifest();
157826
157830
  }
157827
- else {
157828
- // At this stage we do not know the format of the image so we will attempt
157829
- // to extract the archive using the dockerExtractor but fall back to use the
157830
- // ociExtractor if we encounter an invalid format.
157831
- // This will happen on images pulled by the docker binary when using
157832
- // containerd under the hood
157833
- // @see https://snyksec.atlassian.net/browse/LUM-147
157834
- try {
157835
- extractor = extractors.get(types_1.ImageType.DockerArchive);
157836
- archiveContent = await extractor.getLayersAndManifest();
157837
- }
157838
- catch (err) {
157839
- if (err instanceof InvalidArchiveError) {
157831
+ catch (err) {
157832
+ if (err instanceof InvalidArchiveError) {
157833
+ // fallback to the other extractor if layer extraction failed
157834
+ if (imageType === types_1.ImageType.DockerArchive) {
157840
157835
  extractor = extractors.get(types_1.ImageType.OciArchive);
157841
- archiveContent = await extractor.getLayersAndManifest();
157842
157836
  }
157843
157837
  else {
157844
- throw err;
157838
+ extractor = extractors.get(types_1.ImageType.DockerArchive);
157845
157839
  }
157840
+ archiveContent = await extractor.getLayersAndManifest();
157841
+ }
157842
+ else {
157843
+ throw err;
157846
157844
  }
157847
157845
  }
157848
157846
  return {