mirror of
https://github.com/abraunegg/onedrive
synced 2026-03-14 14:35:46 +01:00
Fix Bug #3613: Fix Graph search(q=…) escaping for apostrophes
* Escape single quotes per OData rules (double ' → '') before URL-encoding the search string. Prevents HTTP 400 BadRequest “Syntax error …” for names that contain single quotes
This commit is contained in:
parent
85c8a2e39f
commit
13a80e9fee
1 changed files with 5 additions and 1 deletions
|
|
@ -1002,8 +1002,12 @@ class OneDriveApi {
|
|||
|
||||
// https://learn.microsoft.com/en-us/onedrive/developer/rest-api/api/driveitem_search
|
||||
JSONValue searchDriveForPath(string driveId, string path) {
|
||||
// OData string literal escaping: a single quote inside a '...' literal becomes doubled.
|
||||
// Then URL-encode for safe transport
|
||||
auto odataSafe = path.replace("'", "''");
|
||||
auto encoded = encodeComponent(odataSafe);
|
||||
string url;
|
||||
url = "https://graph.microsoft.com/v1.0/drives/" ~ driveId ~ "/root/search(q='" ~ encodeComponent(path) ~ "')";
|
||||
url = "https://graph.microsoft.com/v1.0/drives/" ~ driveId ~ "/root/search(q='" ~ encoded ~ "')";
|
||||
return get(url);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue