Skip to content

Commit f7f2d55

Browse files
committed
fix(integrations): encode firecrawl poll job ids and split arxiv bare ids without a regex tail
1 parent e9d4c1f commit f7f2d55

5 files changed

Lines changed: 25 additions & 19 deletions

File tree

‎apps/sim/tools/arxiv/get_paper.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ function arxivPaperId(input: string): string {
1414
const linkPath = arxivLinkPath(
1515
SCHEMELESS_ARXIV_LINK.test(trimmed) ? `https://${trimmed}` : trimmed
1616
)
17-
const id = linkPath ?? trimmed.replace(/[?#].*$/, '')
17+
const id = linkPath ?? trimmed.split(/[?#]/)[0]
1818
return id.replace(/\.pdf$/, '')
1919
}
2020

‎apps/sim/tools/firecrawl/agent.ts‎

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -123,14 +123,17 @@ export const agentTool: ToolConfig<AgentParams, AgentResponse> = {
123123
while (elapsedTime < MAX_POLL_TIME_MS) {
124124
try {
125125
signal?.throwIfAborted()
126-
const statusResponse = await outboundFetch(`https://api.firecrawl.dev/v2/agent/${jobId}`, {
127-
method: 'GET',
128-
headers: {
129-
Authorization: `Bearer ${params.apiKey}`,
130-
'Content-Type': 'application/json',
131-
},
132-
signal,
133-
})
126+
const statusResponse = await outboundFetch(
127+
`https://api.firecrawl.dev/v2/agent/${encodeURIComponent(jobId)}`,
128+
{
129+
method: 'GET',
130+
headers: {
131+
Authorization: `Bearer ${params.apiKey}`,
132+
'Content-Type': 'application/json',
133+
},
134+
signal,
135+
}
136+
)
134137

135138
if (!statusResponse.ok) {
136139
throw new Error(`Failed to get agent status: ${statusResponse.statusText}`)

‎apps/sim/tools/firecrawl/batch-scrape.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ export const batchScrapeTool: ToolConfig<FirecrawlBatchScrapeParams, FirecrawlBa
202202
try {
203203
signal?.throwIfAborted()
204204
const statusResponse = await outboundFetch(
205-
`https://api.firecrawl.dev/v2/batch/scrape/${jobId}`,
205+
`https://api.firecrawl.dev/v2/batch/scrape/${encodeURIComponent(jobId)}`,
206206
{
207207
method: 'GET',
208208
headers: {

‎apps/sim/tools/firecrawl/crawl.ts‎

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -248,14 +248,17 @@ export const crawlTool: ToolConfig<FirecrawlCrawlParams, FirecrawlCrawlResponse>
248248
while (elapsedTime < MAX_POLL_TIME_MS) {
249249
try {
250250
signal?.throwIfAborted()
251-
const statusResponse = await outboundFetch(`https://api.firecrawl.dev/v2/crawl/${jobId}`, {
252-
method: 'GET',
253-
headers: {
254-
Authorization: `Bearer ${params.apiKey}`,
255-
'Content-Type': 'application/json',
256-
},
257-
signal,
258-
})
251+
const statusResponse = await outboundFetch(
252+
`https://api.firecrawl.dev/v2/crawl/${encodeURIComponent(jobId)}`,
253+
{
254+
method: 'GET',
255+
headers: {
256+
Authorization: `Bearer ${params.apiKey}`,
257+
'Content-Type': 'application/json',
258+
},
259+
signal,
260+
}
261+
)
259262

260263
if (!statusResponse.ok) {
261264
throw new Error(`Failed to get crawl status: ${statusResponse.statusText}`)

‎apps/sim/tools/firecrawl/extract.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ export const extractTool: ToolConfig<ExtractParams, ExtractResponse> = {
177177
try {
178178
signal?.throwIfAborted()
179179
const statusResponse = await outboundFetch(
180-
`https://api.firecrawl.dev/v2/extract/${jobId}`,
180+
`https://api.firecrawl.dev/v2/extract/${encodeURIComponent(jobId)}`,
181181
{
182182
method: 'GET',
183183
headers: {

0 commit comments

Comments
 (0)