onedrive: fix driveID of src being moved not determined correctly

This commit is contained in:
Cnly 2018-12-26 16:27:58 +08:00
parent 64e303321b
commit 108ec53c0c
1 changed files with 10 additions and 8 deletions

View File

@ -990,8 +990,9 @@ func (f *Fs) Move(src fs.Object, remote string) (fs.Object, error) {
}
id, dstDriveID, _ := parseNormalizedID(directoryID)
_, srcObjDriveID, _ := parseNormalizedID(srcObj.id)
if dstDriveID != srcObj.fs.driveID {
if dstDriveID != srcObjDriveID {
// https://docs.microsoft.com/en-us/graph/api/driveitem-move?view=graph-rest-1.0
// "Items cannot be moved between Drives using this request."
return nil, fs.ErrorCantMove
@ -1082,7 +1083,14 @@ func (f *Fs) DirMove(src fs.Fs, srcRemote, dstRemote string) error {
}
parsedDstDirID, dstDriveID, _ := parseNormalizedID(dstDirectoryID)
if dstDriveID != srcFs.driveID {
// Find ID of src
srcID, err := srcFs.dirCache.FindDir(srcRemote, false)
if err != nil {
return err
}
_, srcDriveID, _ := parseNormalizedID(srcID)
if dstDriveID != srcDriveID {
// https://docs.microsoft.com/en-us/graph/api/driveitem-move?view=graph-rest-1.0
// "Items cannot be moved between Drives using this request."
return fs.ErrorCantDirMove
@ -1100,12 +1108,6 @@ func (f *Fs) DirMove(src fs.Fs, srcRemote, dstRemote string) error {
}
}
// Find ID of src
srcID, err := srcFs.dirCache.FindDir(srcRemote, false)
if err != nil {
return err
}
// Get timestamps of src so they can be preserved
srcInfo, _, err := srcFs.readMetaDataForPathRelativeToID(srcID, "")
if err != nil {