fix: 解决同步快照路径错误的问题 (#1863)

This commit is contained in:
ssongliu 2023-08-07 15:50:28 +08:00 committed by GitHub
parent 7721395748
commit 2e73857b42
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 4 deletions

View File

@ -282,7 +282,11 @@ func (u *BackupService) ListFiles(req dto.BackupSearchFile) ([]interface{}, erro
if err != nil {
return nil, err
}
return client.ListObjects("system_snapshot/")
prefix := "system_snapshot"
if len(backup.BackupPath) != 0 {
prefix = path.Join("/"+strings.TrimPrefix(backup.BackupPath, "/"), prefix)
}
return client.ListObjects(prefix)
}
func (u *BackupService) NewClient(backup *model.BackupAccount) (cloud_storage.CloudStorageClient, error) {

View File

@ -211,9 +211,6 @@ func (onedrive *oneDriveClient) ListObjects(prefix string) ([]interface{}, error
if err := onedrive.client.Do(context.Background(), req, false, &driveItems); err != nil {
return nil, fmt.Errorf("do request for list failed, err: %v", err)
}
for _, item := range driveItems.DriveItems {
return nil, fmt.Errorf("id: %v, name: %s \n", item.Id, item.Name)
}
var itemList []interface{}
for _, item := range driveItems.DriveItems {