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

ftp: more workarounds for FTP servers to fix mkParentDir - fixes #2181

Nick Craig-Woodae562b5a4fb5
diff --git a/backend/ftp/ftp.go b/backend/ftp/ftp.go
index eb51bd833..a06f977f0 100644
--- a/backend/ftp/ftp.go
+++ b/backend/ftp/ftp.go
@@ -259,7 +259,7 @@ func translateErrorDir(err error) error {
switch errX := err.(type) {
case *textproto.Error:
switch errX.Code {
- case ftp.StatusFileUnavailable:
+ case ftp.StatusFileUnavailable, ftp.StatusFileActionIgnored:
err = fs.ErrorDirNotFound
}
}
@@ -296,7 +296,7 @@ func (f *Fs) NewObject(remote string) (o fs.Object, err error) {
// defer fs.Trace(remote, "")("o=%v, err=%v", &o, &err)
entry, err := f.findItem(remote)
if err != nil {
- return nil, errors.Wrap(err, "NewObject")
+ return nil, err
}
if entry != nil && entry.Type != ftp.EntryTypeFolder {
o := &Object{
@@ -475,6 +475,13 @@ func (f *Fs) mkdir(abspath string) error {
}
err = c.MakeDir(abspath)
f.putFtpConnection(&c, err)
+ switch errX := err.(type) {
+ case *textproto.Error:
+ switch errX.Code {
+ case ftp.StatusFileUnavailable: // dir already exists: see issue #2181
+ err = nil
+ }
+ }
return err
}