From 0b4e58228dee6044e56646f429da0f7cf73882d5 Mon Sep 17 00:00:00 2001 From: Nick Craig-Wood Date: Mon, 24 Nov 2025 15:11:00 +0000 Subject: [PATCH] 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 --- backend/drive/drive.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/backend/drive/drive.go b/backend/drive/drive.go index ffccadbd5..c0b9c3cec 100644 --- a/backend/drive/drive.go +++ b/backend/drive/drive.go @@ -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