From a9c49c50a06ebf7cea0aaa3329dd0fb3b9fcef9a Mon Sep 17 00:00:00 2001 From: Jason Zheng Date: Thu, 2 Jun 2022 01:15:09 +0800 Subject: [PATCH] ftp: add support for `disable_utf8` option - fixes #6209 --- backend/ftp/ftp.go | 9 +++++++++ docs/content/flags.md | 1 + docs/content/ftp.md | 11 +++++++++++ 3 files changed, 21 insertions(+) diff --git a/backend/ftp/ftp.go b/backend/ftp/ftp.go index f9e3d1c83..c5b39b24c 100644 --- a/backend/ftp/ftp.go +++ b/backend/ftp/ftp.go @@ -100,6 +100,11 @@ to an encrypted one. Cannot be used in combination with implicit FTP.`, Help: "Disable using MLSD even if server advertises support.", Default: false, Advanced: true, + }, { + Name: "disable_utf8", + Help: "Disable using UTF-8 even if server advertises support.", + Default: false, + Advanced: true, }, { Name: "writing_mdtm", Help: "Use MDTM to set modification time (VsFtpd quirk)", @@ -184,6 +189,7 @@ type Options struct { SkipVerifyTLSCert bool `config:"no_check_certificate"` DisableEPSV bool `config:"disable_epsv"` DisableMLSD bool `config:"disable_mlsd"` + DisableUTF8 bool `config:"disable_utf8"` WritingMDTM bool `config:"writing_mdtm"` IdleTimeout fs.Duration `config:"idle_timeout"` CloseTimeout fs.Duration `config:"close_timeout"` @@ -338,6 +344,9 @@ func (f *Fs) ftpConnection(ctx context.Context) (c *ftp.ServerConn, err error) { if f.opt.DisableMLSD { ftpConfig = append(ftpConfig, ftp.DialWithDisabledMLSD(true)) } + if f.opt.DisableUTF8 { + ftpConfig = append(ftpConfig, ftp.DialWithDisabledUTF8(true)) + } if f.opt.ShutTimeout != 0 && f.opt.ShutTimeout != fs.DurationOff { ftpConfig = append(ftpConfig, ftp.DialWithShutTimeout(time.Duration(f.opt.ShutTimeout))) } diff --git a/docs/content/flags.md b/docs/content/flags.md index 12cd491f5..69a0ea380 100644 --- a/docs/content/flags.md +++ b/docs/content/flags.md @@ -337,6 +337,7 @@ and may be set in the config file. --ftp-concurrency int Maximum number of FTP simultaneous connections, 0 for unlimited --ftp-disable-epsv Disable using EPSV even if server advertises support --ftp-disable-mlsd Disable using MLSD even if server advertises support + --ftp-disable-utf8 Disable using UTF-8 even if server advertises support --ftp-disable-tls13 Disable TLS 1.3 (workaround for FTP servers with buggy TLS) --ftp-encoding MultiEncoder The encoding for the backend (default Slash,Del,Ctl,RightSpace,Dot) --ftp-explicit-tls Use Explicit FTPS (FTP over TLS) diff --git a/docs/content/ftp.md b/docs/content/ftp.md index 836eecf3e..203e944bc 100644 --- a/docs/content/ftp.md +++ b/docs/content/ftp.md @@ -267,6 +267,17 @@ Properties: - Type: bool - Default: false +#### --ftp-disable-utf8 + +Disable using UTF-8 even if server advertises support. + +Properties: + +- Config: disable_utf8 +- Env Var: RCLONE_FTP_DISABLE_UTF8 +- Type: bool +- Default: false + #### --ftp-writing-mdtm Use MDTM to set modification time (VsFtpd quirk)