From 1a9e6a527d0f13f4fc047a67570a4a943fdd16bb Mon Sep 17 00:00:00 2001 From: Nick Craig-Wood Date: Tue, 17 Sep 2024 16:35:33 +0100 Subject: [PATCH] ftp: implement --ftp-no-check-upload to allow upload to write only dirs Fixes #8079 --- backend/ftp/ftp.go | 35 +++++++++++++++++++++++++++++++---- 1 file changed, 31 insertions(+), 4 deletions(-) diff --git a/backend/ftp/ftp.go b/backend/ftp/ftp.go index 75f6e9cdb..4c9db0a9c 100644 --- a/backend/ftp/ftp.go +++ b/backend/ftp/ftp.go @@ -180,12 +180,28 @@ If this is set and no password is supplied then rclone will ask for a password Default: "", Help: `Socks 5 proxy host. - Supports the format user:pass@host:port, user@host:port, host:port. +Supports the format user:pass@host:port, user@host:port, host:port. - Example: +Example: - myUser:myPass@localhost:9005 - `, + myUser:myPass@localhost:9005 +`, + Advanced: true, + }, { + Name: "no_check_upload", + Default: false, + Help: `Don't check the upload is OK + +Normally rclone will try to check the upload exists after it has +uploaded a file to make sure the size and modification time are as +expected. + +This flag stops rclone doing these checks. This enables uploading to +folders which are write only. + +You will likely need to use the --inplace flag also if uploading to +a write only folder. +`, Advanced: true, }, { Name: config.ConfigEncoding, @@ -232,6 +248,7 @@ type Options struct { AskPassword bool `config:"ask_password"` Enc encoder.MultiEncoder `config:"encoding"` SocksProxy string `config:"socks_proxy"` + NoCheckUpload bool `config:"no_check_upload"` } // Fs represents a remote FTP server @@ -1303,6 +1320,16 @@ func (o *Object) Update(ctx context.Context, in io.Reader, src fs.ObjectInfo, op return fmt.Errorf("update stor: %w", err) } o.fs.putFtpConnection(&c, nil) + if o.fs.opt.NoCheckUpload { + o.info = &FileInfo{ + Name: o.remote, + Size: uint64(src.Size()), + ModTime: src.ModTime(ctx), + precise: true, + IsDir: false, + } + return nil + } if err = o.SetModTime(ctx, src.ModTime(ctx)); err != nil { return fmt.Errorf("SetModTime: %w", err) }