mirror of
https://github.com/rclone/rclone.git
synced 2025-11-23 21:44:49 +02:00
b2: allow individual old versions to be deleted with --b2-versions - fixes #1626
This commit is contained in:
@@ -72,7 +72,7 @@ const (
|
|||||||
|
|
||||||
// Globals
|
// Globals
|
||||||
var (
|
var (
|
||||||
errNotWithVersions = errors.New("can't modify or delete files in --b2-versions mode")
|
errNotWithVersions = errors.New("can't modify files in --b2-versions mode")
|
||||||
errNotWithVersionAt = errors.New("can't modify or delete files in --b2-version-at mode")
|
errNotWithVersionAt = errors.New("can't modify or delete files in --b2-version-at mode")
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -2334,7 +2334,10 @@ func (f *Fs) OpenChunkWriter(ctx context.Context, remote string, src fs.ObjectIn
|
|||||||
func (o *Object) Remove(ctx context.Context) error {
|
func (o *Object) Remove(ctx context.Context) error {
|
||||||
bucket, bucketPath := o.split()
|
bucket, bucketPath := o.split()
|
||||||
if o.fs.opt.Versions {
|
if o.fs.opt.Versions {
|
||||||
return errNotWithVersions
|
t, path := api.RemoveVersion(bucketPath)
|
||||||
|
if !t.IsZero() {
|
||||||
|
return o.fs.deleteByID(ctx, o.id, path)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if o.fs.opt.VersionAt.IsSet() {
|
if o.fs.opt.VersionAt.IsSet() {
|
||||||
return errNotWithVersionAt
|
return errNotWithVersionAt
|
||||||
|
|||||||
@@ -192,7 +192,7 @@ flag which permanently removes files on deletion instead of hiding
|
|||||||
them.
|
them.
|
||||||
|
|
||||||
Old versions of files, where available, are visible using the
|
Old versions of files, where available, are visible using the
|
||||||
`--b2-versions` flag.
|
`--b2-versions` flag. These can be deleted as required with `delete`.
|
||||||
|
|
||||||
It is also possible to view a bucket as it was at a certain point in time,
|
It is also possible to view a bucket as it was at a certain point in time,
|
||||||
using the `--b2-version-at` flag. This will show the file versions as they
|
using the `--b2-version-at` flag. This will show the file versions as they
|
||||||
|
|||||||
Reference in New Issue
Block a user