fichier: check if more than one upload link is returned #5152

This commit is contained in:
Nick Craig-Wood 2021-03-23 10:22:56 +00:00
parent 116a8021bb
commit 886dfd23e2
1 changed files with 4 additions and 2 deletions

View File

@ -348,8 +348,10 @@ func (f *Fs) putUnchecked(ctx context.Context, in io.Reader, remote string, size
return nil, err return nil, err
} }
if len(fileUploadResponse.Links) != 1 { if len(fileUploadResponse.Links) == 0 {
return nil, errors.New("unexpected amount of files") return nil, errors.New("upload response not found")
} else if len(fileUploadResponse.Links) > 1 {
fs.Debugf(remote, "Multiple upload responses found, using the first")
} }
link := fileUploadResponse.Links[0] link := fileUploadResponse.Links[0]