diff --git a/backend/b2/b2.go b/backend/b2/b2.go index b18a9b890..0e409e73b 100644 --- a/backend/b2/b2.go +++ b/backend/b2/b2.go @@ -72,7 +72,7 @@ const ( // Globals 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") ) @@ -2334,7 +2334,10 @@ func (f *Fs) OpenChunkWriter(ctx context.Context, remote string, src fs.ObjectIn func (o *Object) Remove(ctx context.Context) error { bucket, bucketPath := o.split() 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() { return errNotWithVersionAt diff --git a/docs/content/b2.md b/docs/content/b2.md index 982310ea2..4b23d9565 100644 --- a/docs/content/b2.md +++ b/docs/content/b2.md @@ -192,7 +192,7 @@ flag which permanently removes files on deletion instead of hiding them. 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, using the `--b2-version-at` flag. This will show the file versions as they