mirror of
https://github.com/open-webui/oikb.git
synced 2026-11-05 01:27:25 +00:00
[GH-ISSUE #96] SharePoint connector ignores @odata.nextLink — folders with more than one page of children are silently truncated #61
Labels
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
open-webui/oikb#61
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @wichmann-git on GitHub (Aug 4, 2026).
Original GitHub issue: https://github.com/open-webui/oikb/issues/96
Summary
SharePointConnector._walk_folderissues a singleGET .../childrenrequest per folder and reads only thevaluearray. Microsoft Graph paginates this endpoint: when a folder has more children than fit in one page, the response carries an@odata.nextLinkpointing at the next page. That field is never read, so everything beyond the first page is invisible to the connector.There is no error.
raise_for_status()passes, the sync reports success, and the missing files are indistinguishable — from oikb's point of view — from files that do not exist in SharePoint.Impact
Worse than "some files are not uploaded": because the manifest drives the diff, files that were synced before the folder crossed the page boundary are now considered deleted at the source and get removed from the Knowledge Base on the next run. A sync that reports
N unchanged, M deletedlooks healthy while silently shrinking the KB.Two aggravating factors:
/childrenreturns folders and files in one list, so the page budget is shared. A folder with 150 files and 60 subfolders is already past 200 entries without ever holding 200 files._walk_folderonly recurses into folders it actually saw invalue, so one dropped folder entry silently removes every file beneath it, at any depth.Affected code
src/oikb/connectors/sharepoint.py— identical onmainand in thev0.4.0release image:Reached from
build_manifest(), so every SharePoint sync is affected.Reproduction
The default page size for
driveItemchildren is 200, so this only bites on large folders.$topreproduces it at any size — the connector's behaviour is identical, only the threshold moves:Following
@odata.nextLinkon the same folder yields all 187 entries across 4 pages.Observed against a real tenant: a document library with 536 files in three monthly folders (154 / 181 / 187 entries). Nothing is lost today; the largest folder is 13 entries from the threshold and grows monthly.
Suggested fix
Loop over pages instead of reading one response:
One implementation note:
@odata.nextLinkis an absolute URL.httpxuses absolute URLs as given even when the client has abase_url, so it can be passed straight back intoself._http.get().Prior art in this repo: the Teams connector talks to Graph and already follows
@odata.nextLink, and #69 fixed the same class of bug for Jira. SharePoint looks like an oversight rather than a design decision.Environment
v0.4.0(ghcr.io/open-webui/oikb:0.4.0), daemon modeSHAREPOINT_CLIENT_ID/SHAREPOINT_TENANT_ID/SHAREPOINT_CLIENT_SECRET), Graph application permissionSites.Read.Allsharepoint:<site-id>/Documentsmainat the time of writingOnly
sharepoint.pywas examined — other connectors may share the pattern.