[PR #121] [MERGED] fix(sharepoint): percent-encode item paths in Graph URLs #120

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

📋 Pull Request Information

Original PR: https://github.com/open-webui/oikb/pull/121
Author: @a-nych
Created: 9/16/2026
Status: ✅ Merged
Merged: 9/16/2026
Merged by: @tjbck

Base: main ← Head: fix/sharepoint-graph-path-encoding


📝 Commits (1)

  • 913d20a fix(sharepoint): percent-encode item paths in Graph URLs

📊 Changes

1 file changed (+3 additions, -2 deletions)

View changed files

📝 src/oikb/connectors/sharepoint.py (+3 -2)

📄 Description

The SharePoint connector interpolates item names straight into Graph's /root:/{path}: addressing form, without percent-encoding:

url = f"/drives/{self._drive_id}/root:/{folder_path}:/children"
...
resp = self._http.get(f"/drives/{self._drive_id}/root:/{file_path}:/content")

A name containing # ends the URL path at the fragment marker. Walking a library whose first folder is #Archiwum lub do przerobienia therefore asks Graph for:

GET https://graph.microsoft.com/v1.0/drives/{id}/root:/
-> 400 Bad Request

and the whole sync aborts on raise_for_status(). ? truncates the same way, and a literal % in a name can turn into an unintended escape. read_file has the identical flaw, so even libraries that enumerate cleanly can fail at download time.

Encoding with quote() (default safe="/") leaves the path separators structural and escapes everything else.

Verified against a live SharePoint library of 317 files: before, the walk dies on the first # folder; after, the full manifest builds and files inside that folder download correctly.

🤖 Generated with Claude Code


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/open-webui/oikb/pull/121 **Author:** [@a-nych](https://github.com/a-nych) **Created:** 9/16/2026 **Status:** ✅ Merged **Merged:** 9/16/2026 **Merged by:** [@tjbck](https://github.com/tjbck) **Base:** `main` ← **Head:** `fix/sharepoint-graph-path-encoding` --- ### 📝 Commits (1) - [`913d20a`](https://github.com/open-webui/oikb/commit/913d20aa102594537cc6bb06034e6a9266697f28) fix(sharepoint): percent-encode item paths in Graph URLs ### 📊 Changes **1 file changed** (+3 additions, -2 deletions) <details> <summary>View changed files</summary> 📝 `src/oikb/connectors/sharepoint.py` (+3 -2) </details> ### 📄 Description The SharePoint connector interpolates item names straight into Graph's `/root:/{path}:` addressing form, without percent-encoding: ```python url = f"/drives/{self._drive_id}/root:/{folder_path}:/children" ... resp = self._http.get(f"/drives/{self._drive_id}/root:/{file_path}:/content") ``` A name containing `#` ends the URL path at the fragment marker. Walking a library whose first folder is `#Archiwum lub do przerobienia` therefore asks Graph for: ``` GET https://graph.microsoft.com/v1.0/drives/{id}/root:/ -> 400 Bad Request ``` and the whole sync aborts on `raise_for_status()`. `?` truncates the same way, and a literal `%` in a name can turn into an unintended escape. `read_file` has the identical flaw, so even libraries that enumerate cleanly can fail at download time. Encoding with `quote()` (default `safe="/"`) leaves the path separators structural and escapes everything else. Verified against a live SharePoint library of 317 files: before, the walk dies on the first `#` folder; after, the full manifest builds and files inside that folder download correctly. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-18 21:14:30 +00:00
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#120
No description provided.