fix: check for bucket existence before FTP upload (#18496)

This commit is contained in:
Sveinn 2023-11-21 21:36:32 -08:00 committed by GitHub
parent 891c60d83d
commit d67e4d5b17
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -290,6 +290,13 @@ func (f *sftpDriver) Filewrite(r *sftp.Request) (w io.WriterAt, err error) {
if err != nil { if err != nil {
return nil, err 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() pr, pw := io.Pipe()