Skip to content

Commit

Permalink
fix: tweak r2 paths
Browse files Browse the repository at this point in the history
  • Loading branch information
maxakuru committed Oct 21, 2024
1 parent 0959827 commit c90abd4
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/utils/r2.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import { errorWithResponse } from './http.js';
* @returns {Promise<Product>} - A promise that resolves to the product.
*/
export async function fetchProduct(ctx, config, sku) {
const key = `${config.org}/${config.site}/${config.env}/${config.storeCode}/${config.storeViewCode}/${sku}.json`;
const key = `${config.org}/${config.site}/${config.env}/${config.storeCode}/${config.storeViewCode}/products/${sku}.json`;
const object = await ctx.env.CATALOG_BUCKET.get(key);

if (!object) {
Expand Down Expand Up @@ -52,7 +52,7 @@ export async function saveProducts(ctx, config, products) {
const storePromises = batch.map(async (product) => {
try {
const { sku, name, urlKey } = product;
const key = `${config.org}/${config.site}/${config.env}/${config.storeCode}/${config.storeViewCode}/${sku}.json`;
const key = `${config.org}/${config.site}/${config.env}/${config.storeCode}/${config.storeViewCode}/products/${sku}.json`;
const body = JSON.stringify(product);
const customMetadata = { sku, name, urlKey };

Expand Down

0 comments on commit c90abd4

Please sign in to comment.