From d67e4d5b174714afabb8611c25af99528e8ec3fd Mon Sep 17 00:00:00 2001 From: Sveinn Date: Tue, 21 Nov 2023 21:36:32 -0800 Subject: [PATCH] fix: check for bucket existence before FTP upload (#18496) --- cmd/sftp-server-driver.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/cmd/sftp-server-driver.go b/cmd/sftp-server-driver.go index 365d55a65..c39c9b232 100644 --- a/cmd/sftp-server-driver.go +++ b/cmd/sftp-server-driver.go @@ -290,6 +290,13 @@ func (f *sftpDriver) Filewrite(r *sftp.Request) (w io.WriterAt, err error) { if err != nil { return nil, err } + ok, err := clnt.BucketExists(r.Context(), bucket) + if err != nil { + return nil, err + } + if !ok { + return nil, os.ErrNotExist + } pr, pw := io.Pipe()