@bigcommerce/stencil-cli 8.10.4 → 8.10.5

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bigcommerce/stencil-cli",
3
- "version": "8.10.4",
3
+ "version": "8.10.5",
4
4
  "type": "module",
5
5
  "description": "CLI tool to run BigCommerce Stores locally for theme development.",
6
6
  "main": "index.js",
@@ -115,15 +115,24 @@ internals.getResponse = async (request) => {
115
115
  const contentType = response.headers['content-type'] || '';
116
116
  const isResponseJson = contentType.toLowerCase().includes('application/json');
117
117
  const isWebDavRequest = request.path.startsWith('/content');
118
+ const isBinaryContent = contentType
119
+ .toLowerCase()
120
+ .match(/^(image|video|audio|application\/octet-stream|application\/pdf)/);
118
121
  let bcAppData = response.data;
119
122
 
120
123
  if (isResponseJson) {
121
124
  bcAppData = JSON.parse(await readFromStream(response.data));
122
125
  } else if (isWebDavRequest) {
123
- const tappedStream = tapStream(response.data, (body) => {
124
- return body;
125
- });
126
- bcAppData = await readStream(tappedStream);
126
+ if (isBinaryContent) {
127
+ // For binary content, don't read the stream - pass it through as-is
128
+ bcAppData = response.data;
129
+ } else {
130
+ // For text content, read as string
131
+ const tappedStream = tapStream(response.data, (body) => {
132
+ return body;
133
+ });
134
+ bcAppData = await readStream(tappedStream, false);
135
+ }
127
136
  }
128
137
  // cache response
129
138
  cache.put(