Spaces:
Build error
Build error
fix: pdf mode and google web cache
Browse files
backend/functions/src/services/snapshot-formatter.ts
CHANGED
|
@@ -136,7 +136,8 @@ export class SnapshotFormatter extends AsyncService {
|
|
| 136 |
}
|
| 137 |
|
| 138 |
let pdfMode = false;
|
| 139 |
-
|
|
|
|
| 140 |
const pdf = await this.pdfExtractor.cachedExtract(snapshot.pdfs[0],
|
| 141 |
this.threadLocal.get('cacheTolerance')
|
| 142 |
);
|
|
@@ -330,7 +331,7 @@ export class SnapshotFormatter extends AsyncService {
|
|
| 330 |
const n = code - 200;
|
| 331 |
if (n < 0 || n >= 200) {
|
| 332 |
const text = snapshot.statusText || STATUS_CODES[code];
|
| 333 |
-
formatted.warning = `Target URL returned error ${code}${text? `: ${text}` : ''}`;
|
| 334 |
}
|
| 335 |
}
|
| 336 |
|
|
|
|
| 136 |
}
|
| 137 |
|
| 138 |
let pdfMode = false;
|
| 139 |
+
// in case of Google Web Cache content
|
| 140 |
+
if (snapshot.pdfs?.length && (!snapshot.title || snapshot.title.startsWith('cache:'))) {
|
| 141 |
const pdf = await this.pdfExtractor.cachedExtract(snapshot.pdfs[0],
|
| 142 |
this.threadLocal.get('cacheTolerance')
|
| 143 |
);
|
|
|
|
| 331 |
const n = code - 200;
|
| 332 |
if (n < 0 || n >= 200) {
|
| 333 |
const text = snapshot.statusText || STATUS_CODES[code];
|
| 334 |
+
formatted.warning = `Target URL returned error ${code}${text ? `: ${text}` : ''}`;
|
| 335 |
}
|
| 336 |
}
|
| 337 |
|