fix(connectors): resolve SharePoint folder paths against the right document library - #6026
Conversation
…cument library Folder-scoped SharePoint connectors failed with "Folder not found" for folders that exist and are readable with the same credential, leaving whole-library sync as the only option. - resolve the target drive explicitly and thread it through listing, download and hydration, which previously hardcoded the site default - resolve folder paths in layers: byte-exact addressing first (unchanged), then a leading document-library name, then a normalized children walk that recovers names carrying non-breaking or invisible whitespace - accept a folder URL from the browser address bar - report the site, library, attempted path and existing folder names on failure instead of a bare "Folder not found" - document the expected folder path format in the connector schema
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
PR SummaryMedium Risk Overview Folder path resolution is now layered: byte-exact path on the default library first (same as before), then treating a leading segment as another library name (e.g. Adds ~22 unit tests with a mocked Microsoft Graph for these resolution paths. Reviewed by Cursor Bugbot for commit 8e304fa. Configure here. |
Greptile SummaryFixes SharePoint folder-scoped connector resolution by targeting the correct document library instead of always using the site default drive.
Confidence Score: 5/5Safe to merge; no blocking defects identified in the drive-aware SharePoint folder resolution changes. Exact path addressing remains first and byte-compatible; drive identity is resolved via the documented default library endpoint and reused for listing and hydration; URL handling and failure messaging are covered by unit tests without a reachable incorrect-resolution path in the diff.
|
| Filename | Overview |
|---|---|
| apps/sim/connectors/sharepoint/sharepoint.ts | Drive-aware path resolution and Graph calls; layered fallbacks preserve prior exact-path behavior and cache driveId on syncContext. |
| apps/sim/connectors/sharepoint/sharepoint.test.ts | Broad mocked-Graph coverage for exact paths, library prefixes, NBSP/case recovery, URLs, and errors. |
| apps/sim/connectors/sharepoint/meta.ts | Corrects folder-path placeholder/description so users omit the library root name. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[folderPath / URL] --> B[Resolve default drive]
B --> C{Exact path on default drive?}
C -->|yes| D[driveId + folderId]
C -->|404| E{Leading segment matches a library?}
E -->|yes| F[Exact / walk remainder on that library]
F -->|hit| D
F -->|miss| G[Normalized children walk on default]
E -->|no| G
G -->|hit| D
G -->|miss| H[Diagnostic Folder not found]
D --> I[listDocuments / getDocument via /drives/driveId]
Reviews (1): Last reviewed commit: "fix(connectors): resolve SharePoint fold..." | Re-trigger Greptile
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 8e304fa. Configure here.

Summary
Folder not foundfor folders that exist and are readable with the same credential — whole-library sync was the only working optionFolder not foundDocuments/Reports) taught a form that can never resolve, sinceroot:is already the library rootNotes on compatibility
Documentsstill wins over the library-name interpretationGET /sites/{siteId}/drive(the documented default library), notdrives[0], whose ordering is not guaranteed — soitem.idis unchanged and no documents are re-indexedSites.Read.Allcovers every endpoint used. Tokenized/:f:/sharing links are deliberately not supported — resolving them requires/shares, which needs write scopes this connector should not holdsync-engine.ts), so the cursor state change has no upgrade surfaceType of Change
Testing
22 unit tests against a mocked Graph covering exact paths, leading/trailing slashes, nested folders,
Documents/Shared Documentsprefixes, non-default libraries, non-breaking-space and case recovery, ambiguity rejection, address-bar URLs, sharing-link rejection, and the diagnostic error contents. Full connector suite (468 tests) passes. Not verified against a live tenant.Checklist