From e07a850be3b360dc74916440bd548e35a46afd78 Mon Sep 17 00:00:00 2001 From: albertony <12441419+albertony@users.noreply.github.com> Date: Fri, 7 Sep 2018 13:58:18 +0200 Subject: [PATCH] jottacloud: add permanent delete support: --jottacloud-hard-delete --- backend/jottacloud/jottacloud.go | 18 ++++++++++++++++-- docs/content/jottacloud.md | 12 +++++++++++- 2 files changed, 27 insertions(+), 3 deletions(-) diff --git a/backend/jottacloud/jottacloud.go b/backend/jottacloud/jottacloud.go index a122434b5..e2f82a32f 100644 --- a/backend/jottacloud/jottacloud.go +++ b/backend/jottacloud/jottacloud.go @@ -72,6 +72,11 @@ func init() { Help: "Files bigger than this will be cached on disk to calculate the MD5 if required.", Default: fs.SizeSuffix(10 * 1024 * 1024), Advanced: true, + }, { + Name: "hard_delete", + Help: "Delete files permanently rather than putting them into the trash.", + Default: false, + Advanced: true, }}, }) } @@ -82,6 +87,7 @@ type Options struct { Pass string `config:"pass"` Mountpoint string `config:"mountpoint"` MD5MemoryThreshold fs.SizeSuffix `config:"md5_memory_limit"` + HardDelete bool `config:"hard_delete"` } // Fs represents a remote jottacloud @@ -596,7 +602,11 @@ func (f *Fs) purgeCheck(dir string, check bool) (err error) { NoResponse: true, } - opts.Parameters.Set("dlDir", "true") + if f.opt.HardDelete { + opts.Parameters.Set("rmDir", "true") + } else { + opts.Parameters.Set("dlDir", "true") + } var resp *http.Response err = f.pacer.Call(func() (bool, error) { @@ -1015,7 +1025,11 @@ func (o *Object) Remove() error { Parameters: url.Values{}, } - opts.Parameters.Set("dl", "true") + if o.fs.opt.HardDelete { + opts.Parameters.Set("rm", "true") + } else { + opts.Parameters.Set("dl", "true") + } return o.fs.pacer.Call(func() (bool, error) { resp, err := o.fs.srv.CallXML(&opts, nil, nil) diff --git a/docs/content/jottacloud.md b/docs/content/jottacloud.md index 4a8bad936..566433406 100644 --- a/docs/content/jottacloud.md +++ b/docs/content/jottacloud.md @@ -108,7 +108,11 @@ the `--jottacloud-md5-memory-limit` flag. ### Deleting files ### -Any files you delete with rclone will end up in the trash. Due to a lack of API documentation emptying the trash is currently only possible via the Jottacloud website. +By default rclone will send all files to the trash when deleting files. +Due to a lack of API documentation emptying the trash is currently +only possible via the Jottacloud website. If deleting permanently +is required then use the `--jottacloud-hard-delete` flag, +or set the equivalent environment variable. ### Versions ### @@ -139,6 +143,12 @@ system. Files bigger than this will be cached on disk to calculate the MD5 if required. (default 10M) +#### --jottacloud-hard-delete #### + +Controls whether files are sent to the trash or deleted +permanently. Defaults to false, namely sending files to the trash. +Use `--jottacloud-hard-delete=true` to delete files permanently instead. + ### Troubleshooting ### Jottacloud exhibits some inconsistent behaviours regarding deleted files and folders which may cause Copy, Move and DirMove operations to previously deleted paths to fail. Emptying the trash should help in such cases. \ No newline at end of file