Skip to content

Commit bc73154

Browse files
waleedlatif1claude
andcommitted
fix(connectors): confluence version metadata fallback and google drive maxFiles guard
- Confluence: use `version?.number` directly (undefined) in metadata instead of `?? ''` (empty string) to prevent Number('') = 0 passing NaN check in mapTags. Hash still uses `?? ''` for string interpolation. - Google Drive: add early return when previouslyFetched >= maxFiles to prevent effectivePageSize <= 0 which violates the API's pageSize requirement (1-1000). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 39e7768 commit bc73154

File tree

2 files changed

+11
-6
lines changed

2 files changed

+11
-6
lines changed

apps/sim/connectors/confluence/confluence.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ function cqlResultToStub(item: Record<string, unknown>, domain: string): Externa
7777
const labelsWrapper = metadata?.labels as Record<string, unknown> | undefined
7878
const labelResults = (labelsWrapper?.results || []) as Record<string, unknown>[]
7979
const labels = labelResults.map((l) => l.name as string)
80-
const versionNumber = version?.number ?? ''
80+
const versionNumber = version?.number
8181

8282
return {
8383
externalId: String(item.id),
@@ -86,7 +86,7 @@ function cqlResultToStub(item: Record<string, unknown>, domain: string): Externa
8686
contentDeferred: true,
8787
mimeType: 'text/plain',
8888
sourceUrl: links?.webui ? `https://${domain}/wiki${links.webui}` : undefined,
89-
contentHash: `confluence:${item.id}:${versionNumber}`,
89+
contentHash: `confluence:${item.id}:${versionNumber ?? ''}`,
9090
metadata: {
9191
spaceId: (item.space as Record<string, unknown>)?.key,
9292
status: item.status,
@@ -274,7 +274,7 @@ export const confluenceConnector: ConnectorConfig = {
274274

275275
const links = page._links as Record<string, unknown> | undefined
276276
const version = page.version as Record<string, unknown> | undefined
277-
const versionNumber = version?.number ?? ''
277+
const versionNumber = version?.number
278278

279279
return {
280280
externalId: String(page.id),
@@ -283,7 +283,7 @@ export const confluenceConnector: ConnectorConfig = {
283283
contentDeferred: false,
284284
mimeType: 'text/plain',
285285
sourceUrl: links?.webui ? `https://${domain}/wiki${links.webui}` : undefined,
286-
contentHash: `confluence:${page.id}:${versionNumber}`,
286+
contentHash: `confluence:${page.id}:${versionNumber ?? ''}`,
287287
metadata: {
288288
spaceId: page.spaceId,
289289
status: page.status,
@@ -410,7 +410,7 @@ async function listDocumentsV2(
410410
const documents: ExternalDocument[] = results.map((page: Record<string, unknown>) => {
411411
const pageId = String(page.id)
412412
const version = page.version as Record<string, unknown> | undefined
413-
const versionNumber = version?.number ?? ''
413+
const versionNumber = version?.number
414414

415415
return {
416416
externalId: pageId,
@@ -421,7 +421,7 @@ async function listDocumentsV2(
421421
sourceUrl: (page._links as Record<string, string>)?.webui
422422
? `https://${domain}/wiki${(page._links as Record<string, string>).webui}`
423423
: undefined,
424-
contentHash: `confluence:${pageId}:${versionNumber}`,
424+
contentHash: `confluence:${pageId}:${versionNumber ?? ''}`,
425425
metadata: {
426426
spaceId: page.spaceId,
427427
status: page.status,

apps/sim/connectors/google-drive/google-drive.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,11 @@ export const googleDriveConnector: ConnectorConfig = {
221221

222222
const maxFiles = sourceConfig.maxFiles ? Number(sourceConfig.maxFiles) : 0
223223
const previouslyFetched = (syncContext?.totalDocsFetched as number) ?? 0
224+
225+
if (maxFiles > 0 && previouslyFetched >= maxFiles) {
226+
return { documents: [], hasMore: false }
227+
}
228+
224229
const remaining = maxFiles > 0 ? maxFiles - previouslyFetched : 0
225230
const effectivePageSize = maxFiles > 0 ? Math.min(pageSize, remaining) : pageSize
226231

0 commit comments

Comments
 (0)