From 07e5a6ed9869fb89602dbcd383f4d58a85024701 Mon Sep 17 00:00:00 2001 From: mawaya <66057718+mawaya@users.noreply.github.com> Date: Sun, 6 Sep 2020 00:50:07 +0800 Subject: [PATCH] drive: return error when fail to create file system --- backend/drive/drive.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/backend/drive/drive.go b/backend/drive/drive.go index 76058f8919c0c..25ca0f6622c85 100755 --- a/backend/drive/drive.go +++ b/backend/drive/drive.go @@ -1371,6 +1371,7 @@ func NewFs(name, path string, m configmap.Mapper) (fs.Fs, error) { // isFileID := false var srcFile *drive.File if rootID, _ := parseRootID(path); len(rootID) > 6 { + f.opt.RootFolderID = rootID err = f.pacer.Call(func() (bool, error) { srcFile, err = f.svc.Files.Get(rootID). @@ -1382,7 +1383,6 @@ func NewFs(name, path string, m configmap.Mapper) (fs.Fs, error) { if err == nil { if srcFile.MimeType != "" && srcFile.MimeType != "application/vnd.google-apps.folder" { fs.Debugf(nil, "Root ID (File): %s", rootID) - f.opt.RootFolderID = rootID } else { if srcFile.DriveId == rootID { fs.Debugf(nil, "Root ID (Drive): %s", rootID) @@ -1395,6 +1395,8 @@ func NewFs(name, path string, m configmap.Mapper) (fs.Fs, error) { srcFile = nil } f.isTeamDrive = f.opt.TeamDriveID != "" + } else { + return nil, err } }