From 87fde687eb85aab567ab44b047b28f64d54a9267 Mon Sep 17 00:00:00 2001 From: HFO4 <912394456@qq.com> Date: Wed, 18 Mar 2020 10:42:41 +0800 Subject: [PATCH] Fix: files with percent sign (%) cannot be deleted in OneDrive --- assets | 2 +- pkg/filesystem/driver/onedrive/api.go | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/assets b/assets index f297f33..4f146a6 160000 --- a/assets +++ b/assets @@ -1 +1 @@ -Subproject commit f297f331f93732c397537d201b118417487284f3 +Subproject commit 4f146a643bebec30e13866bef92cb3327b587fb3 diff --git a/pkg/filesystem/driver/onedrive/api.go b/pkg/filesystem/driver/onedrive/api.go index 519fc4c..5c58344 100644 --- a/pkg/filesystem/driver/onedrive/api.go +++ b/pkg/filesystem/driver/onedrive/api.go @@ -347,10 +347,12 @@ func (client *Client) makeBatchDeleteRequestsBody(files []string) string { } for i, v := range files { v = strings.TrimPrefix(v, "/") + filePath, _ := url.Parse("/me/drive/root:/") + filePath.Path = path.Join(filePath.Path, v) req.Requests[i] = BatchRequest{ ID: v, Method: "DELETE", - URL: "me/drive/root:/" + v, + URL: filePath.EscapedPath(), } }