[GH-ISSUE #135] SharePoint connector: modified files never detected — eTag truncated to 16 chars stays inside the constant GUID portion #79

Open
opened 2026-10-18 21:14:10 +00:00 by bsakaguchi · 0 comments
Owner

Originally created by @pckw on GitHub (Sep 30, 2026).
Original GitHub issue: https://github.com/open-webui/oikb/issues/135

Summary

The SharePoint connector's change detection never fires for in-place content edits. Only additions and deletions are picked up on subsequent syncs; a file edited in place is always reported as unchanged.

Root cause

In src/oikb/connectors/sharepoint.py, _walk_folder() builds the manifest checksum like this:

etag = (item.get("eTag") or item.get("cTag", "")).strip('"')
entries.append(ManifestEntry(
    filename=item["name"],
    path=prefix,
    checksum=etag[:16] if etag else "",
    size=item.get("size", 0),
))

A SharePoint/OneDrive driveItem eTag has the form:

{7A9D4B29-49F0-4F9E-9C2B-2B1E7B9CE1F1},7

The 36-character GUID before the comma stays constant for the item's lifetime; only the number after the comma increments on content changes. Since etag[:16] only takes {7A9D4B29-49F0 — a slice entirely inside the constant GUID — the truncated checksum never changes across edits. The sync/diff step on the server therefore always classifies the file as unmodified.

Additions and deletions are detected correctly, but in-place content modifications are silently never synced.

Steps to reproduce

  1. Configure a SharePoint source, e.g. sharepoint:contoso.sharepoint.com/Documents, and sync it into a Knowledge Base.
  2. Edit the contents of an existing file in the library (and check it in / publish if versioning is enabled).
  3. Run oikb sync --dry-run --verbose against the same source/KB.
  4. Observe the diff: the edited file does not appear under "Modified" — it's reported as unchanged.

Expected behavior

An in-place content edit to a SharePoint file should be classified as modified in the sync diff and re-uploaded to the Knowledge Base.

Suggested fix

Don't truncate the eTag to 16 characters. Either use the full eTag as the checksum, or explicitly extract the version segment after the comma, e.g.:

etag = (item.get("eTag") or item.get("cTag", "")).strip('"')
entries.append(ManifestEntry(
    filename=item["name"],
    path=prefix,
    checksum=etag,  # use the full eTag; do not truncate
    size=item.get("size", 0),
))

Environment

  • oikb version: 0.4.0 (bug also confirmed present in 0.5.0 / main)
  • Deployment: Docker image ghcr.io/open-webui/oikb
  • Connector: SharePoint
Originally created by @pckw on GitHub (Sep 30, 2026). Original GitHub issue: https://github.com/open-webui/oikb/issues/135 ## Summary The SharePoint connector's change detection never fires for in-place content edits. Only additions and deletions are picked up on subsequent syncs; a file edited in place is always reported as unchanged. ## Root cause In `src/oikb/connectors/sharepoint.py`, `_walk_folder()` builds the manifest checksum like this: ```python etag = (item.get("eTag") or item.get("cTag", "")).strip('"') entries.append(ManifestEntry( filename=item["name"], path=prefix, checksum=etag[:16] if etag else "", size=item.get("size", 0), )) ``` A SharePoint/OneDrive driveItem eTag has the form: ``` {7A9D4B29-49F0-4F9E-9C2B-2B1E7B9CE1F1},7 ``` The 36-character GUID before the comma stays constant for the item's lifetime; only the number after the comma increments on content changes. Since `etag[:16]` only takes `{7A9D4B29-49F0` — a slice entirely inside the constant GUID — the truncated checksum never changes across edits. The sync/diff step on the server therefore always classifies the file as unmodified. Additions and deletions are detected correctly, but in-place content modifications are silently never synced. ## Steps to reproduce 1. Configure a SharePoint source, e.g. `sharepoint:contoso.sharepoint.com/Documents`, and sync it into a Knowledge Base. 2. Edit the contents of an existing file in the library (and check it in / publish if versioning is enabled). 3. Run `oikb sync --dry-run --verbose` against the same source/KB. 4. Observe the diff: the edited file does not appear under "Modified" — it's reported as unchanged. ## Expected behavior An in-place content edit to a SharePoint file should be classified as `modified` in the sync diff and re-uploaded to the Knowledge Base. ## Suggested fix Don't truncate the eTag to 16 characters. Either use the full eTag as the checksum, or explicitly extract the version segment after the comma, e.g.: ```python etag = (item.get("eTag") or item.get("cTag", "")).strip('"') entries.append(ManifestEntry( filename=item["name"], path=prefix, checksum=etag, # use the full eTag; do not truncate size=item.get("size", 0), )) ``` ## Environment - oikb version: 0.4.0 (bug also confirmed present in 0.5.0 / main) - Deployment: Docker image `ghcr.io/open-webui/oikb` - Connector: SharePoint
Sign in to join this conversation.
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
open-webui/oikb#79
No description provided.