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

This commit is contained in:
Nick Craig-Wood 2018-04-26 14:53:03 +01:00
parent c01177bc28
commit ae562b5a4f

View File

@ -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
}