1
0
mirror of https://github.com/rclone/rclone.git synced 2025-12-06 00:03:32 +00:00

drive: fix crash when trying to creating shortcut to a Google doc

Before this change, we uses an unguarded type assertion which failed
when NewObject returned a google document instead of an Object.

This change uses the ID() method to read the id which works for all
types of file instead and returns a sensible error if one isn't found.

Fixes #8990
This commit is contained in:
Nick Craig-Wood
2025-11-24 15:11:00 +00:00
parent 46ca0dd7fe
commit 0b4e58228d

View File

@@ -3396,9 +3396,11 @@ func (f *Fs) makeShortcut(ctx context.Context, srcPath string, dstFs *Fs, dstPat
return nil, fmt.Errorf("failed to find source dir: %w", err)
}
isDir = true
} else {
} else if do, ok := srcObj.(fs.IDer); ok {
// source was a file
srcID = srcObj.(*Object).id
srcID = do.ID()
} else {
return nil, fmt.Errorf("unknown source object: %T", srcObj)
}
srcID = actualID(srcID) // link to underlying object not to shortcut