Skip to content

"rsync for cloud storage" - Google Drive, S3, Dropbox, Backblaze B2, One Drive, Swift, Hubic, Wasabi, Google Cloud Storage, Azure Blob, Azure Files, Yandex Files

drive: fix trailing slash mis-identificaton of folder as file

Nick Craig-Wood232d304c1324
diff --git a/backend/drive/drive.go b/backend/drive/drive.go
index 5f1472ccf..625f4a303 100644
--- a/backend/drive/drive.go
+++ b/backend/drive/drive.go
@@ -1512,6 +1512,9 @@ func (f *Fs) newObjectWithExportInfo(
// NewObject finds the Object at remote. If it can't be found
// it returns the error fs.ErrorObjectNotFound.
func (f *Fs) NewObject(ctx context.Context, remote string) (fs.Object, error) {
+ if strings.HasSuffix(remote, "/") {
+ return nil, fs.ErrorIsDir
+ }
info, extension, exportName, exportMimeType, isDocument, err := f.getRemoteInfoWithExport(ctx, remote)
if err != nil {
return nil, err