Skip to content

Commit 01a136d

Browse files
committed
fix(connectors): key the library-prefix hint on the library actually searched
Deriving the flag from `!libraryMatch` suppressed the hint when the path named the default library itself ("Documents/Reports"), which is exactly the case the hint exists for. Key it on whether the reported drive is the default library.
1 parent d7b98c5 commit 01a136d

2 files changed

Lines changed: 15 additions & 1 deletion

File tree

apps/sim/connectors/sharepoint/sharepoint.test.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -283,6 +283,20 @@ describe('resolveFolderTarget', () => {
283283
expect(message).not.toContain('Shared Documents" should be omitted')
284284
})
285285

286+
it('still offers the prefix hint when the path names the default library itself', async () => {
287+
mockGraph({
288+
...defaultDriveRoute,
289+
...sitesDrivesRoute,
290+
...rootChildren(DEFAULT_DRIVE_ID, [folder('d1', 'Archive')]),
291+
})
292+
293+
const error = await resolve('Shared Documents/Reports').catch((e: Error) => e)
294+
295+
const message = (error as Error).message
296+
expect(message).toContain('document library "Documents"')
297+
expect(message).toContain('Shared Documents" should be omitted')
298+
})
299+
286300
it('surfaces a failure to open the default library rather than reporting not-found', async () => {
287301
mockGraph({
288302
[`${GRAPH}/sites/${SITE_ID}/drive?$select=id,name,webUrl`]: { status: 403 },

apps/sim/connectors/sharepoint/sharepoint.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -545,7 +545,7 @@ export async function resolveFolderTarget(
545545
trimmed,
546546
libraryMatch ? segments.slice(1) : segments,
547547
drives,
548-
!libraryMatch,
548+
reportDrive.id === defaultDrive.id,
549549
retryOptions
550550
)
551551
)

0 commit comments

Comments
 (0)