From d77f594ee7d7a8cabb79598f4cfdb5591df0f2c9 Mon Sep 17 00:00:00 2001 From: Nick Craig-Wood Date: Fri, 17 Sep 2021 10:04:19 +0100 Subject: [PATCH] pcloud: return an early error when Put is called with an unknown size This stops the 10 minute pause in the integration tests --- backend/pcloud/pcloud.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/backend/pcloud/pcloud.go b/backend/pcloud/pcloud.go index 1cc967b31..c88764d05 100644 --- a/backend/pcloud/pcloud.go +++ b/backend/pcloud/pcloud.go @@ -1092,6 +1092,10 @@ func (o *Object) Update(ctx context.Context, in io.Reader, src fs.ObjectInfo, op modTime := src.ModTime(ctx) remote := o.Remote() + if size < 0 { + return errors.New("can't upload unknown sizes objects") + } + // Create the directory for the object if it doesn't exist leaf, directoryID, err := o.fs.dirCache.FindPath(ctx, remote, true) if err != nil {