Spaces:
Build error
Build error
fix: potential invalid pdf issue
Browse files- src/api/crawler.ts +1 -1
src/api/crawler.ts
CHANGED
|
@@ -1005,7 +1005,7 @@ export class CrawlerHost extends RPCHost {
|
|
| 1005 |
const pdfUrl = snapshotCopy.pdfs[0];
|
| 1006 |
if (pdfUrl.startsWith('http')) {
|
| 1007 |
const sideLoaded = scrappingOptions?.sideLoad?.impersonate[pdfUrl];
|
| 1008 |
-
if (sideLoaded?.body) {
|
| 1009 |
snapshotCopy.pdfs[0] = pathToFileURL(await sideLoaded?.body.filePath).href;
|
| 1010 |
return this.snapshotFormatter.formatSnapshot(mode, snapshotCopy, nominalUrl, urlValidMs);
|
| 1011 |
}
|
|
|
|
| 1005 |
const pdfUrl = snapshotCopy.pdfs[0];
|
| 1006 |
if (pdfUrl.startsWith('http')) {
|
| 1007 |
const sideLoaded = scrappingOptions?.sideLoad?.impersonate[pdfUrl];
|
| 1008 |
+
if (sideLoaded?.status === 200 && sideLoaded.body) {
|
| 1009 |
snapshotCopy.pdfs[0] = pathToFileURL(await sideLoaded?.body.filePath).href;
|
| 1010 |
return this.snapshotFormatter.formatSnapshot(mode, snapshotCopy, nominalUrl, urlValidMs);
|
| 1011 |
}
|