fix: metadata mismatch if file name contains % while uploading to OneDrive/SharePoint

This commit is contained in:
HFO4
2022-10-15 09:20:25 +08:00
parent 6b0b44f6d0
commit 560097145b
2 changed files with 27 additions and 7 deletions

View File

@@ -37,9 +37,14 @@ const (
// GetSourcePath 获取文件的绝对路径
func (info *FileInfo) GetSourcePath() string {
res, err := url.PathUnescape(info.ParentReference.Path)
if err != nil {
return ""
}
return strings.TrimPrefix(
path.Join(
strings.TrimPrefix(info.ParentReference.Path, "/drive/root:"),
strings.TrimPrefix(res, "/drive/root:"),
info.Name,
),
"/",