Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

prevent purging of enabled spaces #2459

Merged
merged 1 commit into from
Jan 20, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog/unreleased/purge-spaces.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ During the second step all shares, including public shares, in the space will be
When deleting a space the blobs are currently not yet deleted since the decomposedfs will receive some changes soon.

https://github.com/cs3org/reva/pull/2431
https://github.com/cs3org/reva/pull/2458
2 changes: 2 additions & 0 deletions internal/grpc/services/storageprovider/storageprovider.go
Original file line number Diff line number Diff line change
Expand Up @@ -593,6 +593,8 @@ func (s *service) DeleteStorageSpace(ctx context.Context, req *provider.DeleteSt
st = status.NewNotFound(ctx, "not found when deleting space")
case errtypes.PermissionDenied:
st = status.NewPermissionDenied(ctx, err, "permission denied")
case errtypes.BadRequest:
st = status.NewInvalidArg(ctx, err.Error())
default:
st = status.NewInternal(ctx, "error deleting space: "+req.Id.String())
}
Expand Down
4 changes: 4 additions & 0 deletions pkg/storage/utils/decomposedfs/spaces.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ import (
"github.com/cs3org/reva/pkg/appctx"
ctxpkg "github.com/cs3org/reva/pkg/ctx"
"github.com/cs3org/reva/pkg/errtypes"
"github.com/cs3org/reva/pkg/rgrpc/status"
"github.com/cs3org/reva/pkg/storage/utils/decomposedfs/node"
"github.com/cs3org/reva/pkg/storage/utils/decomposedfs/xattrs"
"github.com/cs3org/reva/pkg/utils"
Expand Down Expand Up @@ -351,6 +352,9 @@ func (fs *Decomposedfs) DeleteStorageSpace(ctx context.Context, req *provider.De
}

if purge {
if !strings.Contains(req.Id.OpaqueId, node.TrashIDDelimiter) {
return errtypes.NewErrtypeFromStatus(status.NewInvalidArg(ctx, "can't purge enabled space"))
}
ip := fs.lu.InternalPath(req.Id.OpaqueId)
matches, err := filepath.Glob(ip)
if err != nil {
Expand Down