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

mega: return error if an unknown length file is attempted to be uploaded

Nick Craig-Wooda0016e00d1f7
diff --git a/backend/mega/mega.go b/backend/mega/mega.go
index 8d31f9682..1e43fed07 100644
--- a/backend/mega/mega.go
+++ b/backend/mega/mega.go
@@ -1076,6 +1076,9 @@ func (o *Object) Open(options ...fs.OpenOption) (in io.ReadCloser, err error) {
// The new object may have been created if an error is returned
func (o *Object) Update(in io.Reader, src fs.ObjectInfo, options ...fs.OpenOption) (err error) {
size := src.Size()
+ if size < 0 {
+ return errors.New("mega backend can't upload a file of unknown length")
+ }
//modTime := src.ModTime()
remote := o.Remote()