From e574f966f60dbf850ec349cf3da09c3f1d54daa7 Mon Sep 17 00:00:00 2001 From: Meshari <38118870+MeshariSA0@users.noreply.github.com> Date: Fri, 11 Oct 2024 15:25:21 +0000 Subject: [PATCH] URL Should be same protocol as request --- apps/api/src/controllers/v1/crawl-status.ts | 3 +-- apps/api/src/controllers/v1/crawl.ts | 4 +--- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/apps/api/src/controllers/v1/crawl-status.ts b/apps/api/src/controllers/v1/crawl-status.ts index 63331c9c3..eac3b4f37 100644 --- a/apps/api/src/controllers/v1/crawl-status.ts +++ b/apps/api/src/controllers/v1/crawl-status.ts @@ -100,8 +100,7 @@ export async function crawlStatusController(req: RequestWithAuth x.returnvalue); - const protocol = process.env.ENV === "local" ? req.protocol : "https"; - const nextURL = new URL(`${protocol}://${req.get("host")}/v1/crawl/${req.params.jobId}`); + const nextURL = new URL(`${req.protocol}://${req.get("host")}/v1/crawl/${req.params.jobId}`); nextURL.searchParams.set("skip", (start + data.length).toString()); diff --git a/apps/api/src/controllers/v1/crawl.ts b/apps/api/src/controllers/v1/crawl.ts index c8e449f01..2722b6b88 100644 --- a/apps/api/src/controllers/v1/crawl.ts +++ b/apps/api/src/controllers/v1/crawl.ts @@ -161,12 +161,10 @@ export async function crawlController( await callWebhook(req.auth.team_id, id, null, req.body.webhook, true, "crawl.started"); } - const protocol = process.env.ENV === "local" ? req.protocol : "https"; - return res.status(200).json({ success: true, id, - url: `${protocol}://${req.get("host")}/v1/crawl/${id}`, + url: `${req.protocol}://${req.get("host")}/v1/crawl/${id}`, }); }