Fix: files with percent sign (%) cannot be deleted in OneDrive

This commit is contained in:
HFO4
2020-03-18 10:42:41 +08:00
parent 65cf0f57aa
commit 87fde687eb
2 changed files with 4 additions and 2 deletions

2
assets

Submodule assets updated: f297f331f9...4f146a643b

View File

@@ -347,10 +347,12 @@ func (client *Client) makeBatchDeleteRequestsBody(files []string) string {
} }
for i, v := range files { for i, v := range files {
v = strings.TrimPrefix(v, "/") v = strings.TrimPrefix(v, "/")
filePath, _ := url.Parse("/me/drive/root:/")
filePath.Path = path.Join(filePath.Path, v)
req.Requests[i] = BatchRequest{ req.Requests[i] = BatchRequest{
ID: v, ID: v,
Method: "DELETE", Method: "DELETE",
URL: "me/drive/root:/" + v, URL: filePath.EscapedPath(),
} }
} }