Spaces:
Build error
Build error
fix: sideLoad header detection
Browse files- src/services/curl.ts +3 -3
src/services/curl.ts
CHANGED
|
@@ -180,10 +180,10 @@ export class CurlControl extends AsyncService {
|
|
| 180 |
for (const [k, v] of Object.entries(lastResHeaders)) {
|
| 181 |
const kl = k.toLowerCase();
|
| 182 |
if (kl === 'content-type') {
|
| 183 |
-
contentType = v.toLowerCase();
|
| 184 |
}
|
| 185 |
if (kl === 'content-encoding') {
|
| 186 |
-
contentEncoding = v.toLowerCase();
|
| 187 |
}
|
| 188 |
if (contentType && contentEncoding) {
|
| 189 |
break;
|
|
@@ -334,7 +334,7 @@ export class CurlControl extends AsyncService {
|
|
| 334 |
}
|
| 335 |
}
|
| 336 |
const lastHeaders = curlResult.headers[curlResult.headers.length - 1];
|
| 337 |
-
const contentType = (lastHeaders['Content-Type'] || lastHeaders['content-type']).toLowerCase() || (await curlResult.data?.mimeType) || 'application/octet-stream';
|
| 338 |
const contentDisposition = lastHeaders['Content-Disposition'] || lastHeaders['content-disposition'];
|
| 339 |
const fileName = contentDisposition?.match(/filename="([^"]+)"/i)?.[1] || finalURL.pathname.split('/').pop();
|
| 340 |
|
|
|
|
| 180 |
for (const [k, v] of Object.entries(lastResHeaders)) {
|
| 181 |
const kl = k.toLowerCase();
|
| 182 |
if (kl === 'content-type') {
|
| 183 |
+
contentType = (v || '').toLowerCase();
|
| 184 |
}
|
| 185 |
if (kl === 'content-encoding') {
|
| 186 |
+
contentEncoding = (v || '').toLowerCase();
|
| 187 |
}
|
| 188 |
if (contentType && contentEncoding) {
|
| 189 |
break;
|
|
|
|
| 334 |
}
|
| 335 |
}
|
| 336 |
const lastHeaders = curlResult.headers[curlResult.headers.length - 1];
|
| 337 |
+
const contentType = (lastHeaders['Content-Type'] || lastHeaders['content-type'])?.toLowerCase() || (await curlResult.data?.mimeType) || 'application/octet-stream';
|
| 338 |
const contentDisposition = lastHeaders['Content-Disposition'] || lastHeaders['content-disposition'];
|
| 339 |
const fileName = contentDisposition?.match(/filename="([^"]+)"/i)?.[1] || finalURL.pathname.split('/').pop();
|
| 340 |
|