Skip to content

Commit

Permalink
fix: product image normalizer now properly checks for gallery index
Browse files Browse the repository at this point in the history
  • Loading branch information
znikola committed Jul 27, 2023
1 parent 8a29feb commit 3e758b0
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export class ProductImageNormalizer implements Converter<Occ.Product, Product> {
const images: Images = {};
if (source) {
for (const image of source) {
const isList = image.hasOwnProperty('galleryIndex');
const isList = this.hasGalleryIndex(image);
if (image.imageType) {
if (!images.hasOwnProperty(image.imageType)) {
images[image.imageType] = isList ? [] : {};
Expand Down Expand Up @@ -98,4 +98,9 @@ export class ProductImageNormalizer implements Converter<Occ.Product, Product> {
'') + url
);
}

private hasGalleryIndex(image: Occ.Image) {
const galleryIndex = image.galleryIndex ?? false;
return galleryIndex !== false;
}
}

0 comments on commit 3e758b0

Please sign in to comment.