forked from TrueCloudLab/rclone
yandex: add permanent deletion support
This commit is contained in:
parent
38dc3e93ee
commit
80e47be65f
2 changed files with 19 additions and 4 deletions
|
@ -66,6 +66,11 @@ func init() {
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
Options: append(oauthutil.SharedOptions, []fs.Option{{
|
Options: append(oauthutil.SharedOptions, []fs.Option{{
|
||||||
|
Name: "hard_delete",
|
||||||
|
Help: "Delete files permanently rather than putting them into the trash.",
|
||||||
|
Default: false,
|
||||||
|
Advanced: true,
|
||||||
|
}, {
|
||||||
Name: config.ConfigEncoding,
|
Name: config.ConfigEncoding,
|
||||||
Help: config.ConfigEncodingHelp,
|
Help: config.ConfigEncodingHelp,
|
||||||
Advanced: true,
|
Advanced: true,
|
||||||
|
@ -79,8 +84,9 @@ func init() {
|
||||||
|
|
||||||
// Options defines the configuration for this backend
|
// Options defines the configuration for this backend
|
||||||
type Options struct {
|
type Options struct {
|
||||||
Token string `config:"token"`
|
Token string `config:"token"`
|
||||||
Enc encoder.MultiEncoder `config:"encoding"`
|
HardDelete bool `config:"hard_delete"`
|
||||||
|
Enc encoder.MultiEncoder `config:"encoding"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fs represents a remote yandex
|
// Fs represents a remote yandex
|
||||||
|
@ -630,7 +636,7 @@ func (f *Fs) purgeCheck(ctx context.Context, dir string, check bool) error {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//delete directory
|
//delete directory
|
||||||
return f.delete(ctx, root, false)
|
return f.delete(ctx, root, f.opt.HardDelete)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Rmdir deletes the container
|
// Rmdir deletes the container
|
||||||
|
@ -1141,7 +1147,7 @@ func (o *Object) Update(ctx context.Context, in io.Reader, src fs.ObjectInfo, op
|
||||||
|
|
||||||
// Remove an object
|
// Remove an object
|
||||||
func (o *Object) Remove(ctx context.Context) error {
|
func (o *Object) Remove(ctx context.Context) error {
|
||||||
return o.fs.delete(ctx, o.filePath(), false)
|
return o.fs.delete(ctx, o.filePath(), o.fs.opt.HardDelete)
|
||||||
}
|
}
|
||||||
|
|
||||||
// MimeType of an Object if known, "" otherwise
|
// MimeType of an Object if known, "" otherwise
|
||||||
|
|
|
@ -175,6 +175,15 @@ Leave blank to use the provider defaults.
|
||||||
- Type: string
|
- Type: string
|
||||||
- Default: ""
|
- Default: ""
|
||||||
|
|
||||||
|
#### --yandex-hard-delete
|
||||||
|
|
||||||
|
Delete files permanently rather than putting them into the trash.
|
||||||
|
|
||||||
|
- Config: hard_delete
|
||||||
|
- Env Var: RCLONE_YANDEX_HARD_DELETE
|
||||||
|
- Type: bool
|
||||||
|
- Default: false
|
||||||
|
|
||||||
#### --yandex-encoding
|
#### --yandex-encoding
|
||||||
|
|
||||||
This sets the encoding for the backend.
|
This sets the encoding for the backend.
|
||||||
|
|
Loading…
Reference in a new issue