Merge pull request #582 from mendableai/fix--rawHtml-return-on-crawl
Some checks are pending
Fly Deploy / Pre-deploy checks (push) Waiting to run
Fly Deploy / Test Suite (push) Blocked by required conditions
Fly Deploy / Python SDK Tests (push) Blocked by required conditions
Fly Deploy / JavaScript SDK Tests (push) Blocked by required conditions
Fly Deploy / Go SDK Tests (push) Blocked by required conditions
Fly Deploy / Rust SDK Tests (push) Blocked by required conditions
Fly Deploy / Deploy app (push) Blocked by required conditions
Fly Deploy / Build and publish Python SDK (push) Blocked by required conditions
Fly Deploy / Build and publish JavaScript SDK (push) Blocked by required conditions
Fly Deploy / Build and publish Rust SDK (push) Waiting to run

[Bug] Moved delete rawHtml to end of controller
This commit is contained in:
Nicolas 2024-08-30 12:40:06 -03:00 committed by GitHub
commit 2fd9c285bd
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 21 additions and 0 deletions

View File

@ -56,6 +56,19 @@ export async function crawlStatusController(req: Request, res: Response) {
const data = jobs.map(x => Array.isArray(x.returnvalue) ? x.returnvalue[0] : x.returnvalue);
if (
jobs.length > 0 &&
jobs[0].data &&
jobs[0].data.pageOptions &&
!jobs[0].data.pageOptions.includeRawHtml
) {
data.forEach(item => {
if (item) {
delete item.rawHtml;
}
});
}
res.json({
status: jobStatus,
current: jobStatuses.filter(x => x === "completed" || x === "failed").length,

View File

@ -100,6 +100,14 @@ export async function crawlStatusController(req: RequestWithAuth<CrawlStatusPara
nextURL.searchParams.set("limit", req.query.limit);
}
if (data.length > 0) {
if (!doneJobs[0].data.pageOptions.includeRawHtml) {
for (let ii = 0; ii < doneJobs.length; ii++) {
delete data[ii].rawHtml;
}
}
}
res.status(200).json({
status,
completed: doneJobsLength,