Skip to content

Commit

Permalink
fix: sample image data not showing
Browse files Browse the repository at this point in the history
Signed-off-by: vanpho93 <vanpho02@gmail.com>
  • Loading branch information
vanpho93 committed Feb 17, 2023
1 parent bd52d95 commit a6172e9
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
6 changes: 6 additions & 0 deletions .changeset/curly-clocks-notice.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@reactioncommerce/api-plugin-sample-data": patch
"@reactioncommerce/file-collections": patch
---

fix: sample image data not showing
5 changes: 3 additions & 2 deletions packages/api-plugin-sample-data/src/loaders/loadImages.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
/* eslint-disable no-await-in-loop */
import fs from "fs";
import path from "path";
import { fileURLToPath } from "url";
import { Readable } from "stream";
import pkg from "@reactioncommerce/file-collections";

Expand Down Expand Up @@ -106,8 +107,8 @@ export default async function loadImages(context, shopId) {

const topProdIds = [];
const fileType = "image/jpeg";
const folderPath = "./custom-packages/api-plugin-sample-data/src/images/";

const currentDir = path.dirname(fileURLToPath(import.meta.url));
const folderPath = path.join(currentDir, "../images/");
let fileList = [];
try {
fileList = fs.readdirSync(folderPath);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export default function requestRange(headers, fileSize) {
}

const defaultRange = {
end: fileSize - 1,
end: fileSize,
len: fileSize,
partial: false,
size: fileSize,
Expand Down

0 comments on commit a6172e9

Please sign in to comment.