mirror of
https://github.com/rclone/rclone.git
synced 2024-11-07 17:14:44 +01:00
ftp: more workarounds for FTP servers to fix mkParentDir - fixes #2181
This commit is contained in:
parent
c01177bc28
commit
ae562b5a4f
@ -259,7 +259,7 @@ func translateErrorDir(err error) error {
|
|||||||
switch errX := err.(type) {
|
switch errX := err.(type) {
|
||||||
case *textproto.Error:
|
case *textproto.Error:
|
||||||
switch errX.Code {
|
switch errX.Code {
|
||||||
case ftp.StatusFileUnavailable:
|
case ftp.StatusFileUnavailable, ftp.StatusFileActionIgnored:
|
||||||
err = fs.ErrorDirNotFound
|
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)
|
// defer fs.Trace(remote, "")("o=%v, err=%v", &o, &err)
|
||||||
entry, err := f.findItem(remote)
|
entry, err := f.findItem(remote)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, errors.Wrap(err, "NewObject")
|
return nil, err
|
||||||
}
|
}
|
||||||
if entry != nil && entry.Type != ftp.EntryTypeFolder {
|
if entry != nil && entry.Type != ftp.EntryTypeFolder {
|
||||||
o := &Object{
|
o := &Object{
|
||||||
@ -475,6 +475,13 @@ func (f *Fs) mkdir(abspath string) error {
|
|||||||
}
|
}
|
||||||
err = c.MakeDir(abspath)
|
err = c.MakeDir(abspath)
|
||||||
f.putFtpConnection(&c, err)
|
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
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user