From 85e056017240bf3d82e5a1adb808c7f8115cb28b Mon Sep 17 00:00:00 2001 From: Dylan Depass Date: Sun, 3 Nov 2024 16:51:29 -0500 Subject: [PATCH] fix: force https for images --- src/content/queries/cs-product.js | 3 +-- src/content/queries/cs-variants.js | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/content/queries/cs-product.js b/src/content/queries/cs-product.js index 1787f0e..6ff2f87 100644 --- a/src/content/queries/cs-product.js +++ b/src/content/queries/cs-product.js @@ -25,7 +25,6 @@ export const adapter = (productData) => { } else if (maxPrice == null) { maxPrice = minPrice; } - /** @type {Product} */ const product = { sku: productData.sku, @@ -40,7 +39,7 @@ export const adapter = (productData) => { addToCartAllowed: productData.addToCartAllowed, inStock: productData.inStock, externalId: productData.externalId, - images: productData.images ?? [], + images: productData.images?.filter((img) => img.url.replace('http://', 'https://')) ?? [], attributes: productData.attributes ?? [], options: (productData.options ?? []).map((option) => ({ id: option.id, diff --git a/src/content/queries/cs-variants.js b/src/content/queries/cs-variants.js index db2ec92..d6aa92e 100644 --- a/src/content/queries/cs-variants.js +++ b/src/content/queries/cs-variants.js @@ -27,7 +27,7 @@ export const adapter = (config, variants) => variants.map(({ selections, product description: product.description, url: product.url, inStock: product.inStock, - images: product.images ?? [], + images: product.images?.filter((img) => img.url.replace('http://', 'https://')) ?? [], attributes: product.attributes ?? [], externalId: product.externalId, prices: {