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

add missing error check in decomposedfs #3430

Merged
merged 2 commits into from
Nov 3, 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
10 changes: 0 additions & 10 deletions .drone.star
Original file line number Diff line number Diff line change
Expand Up @@ -313,16 +313,6 @@ def coverage():
"make test",
],
},
{
"name": "codacy",
"image": "plugins/codacy:1",
"pull": "always",
"settings": {
"token": {
"from_secret": "codacy_token",
},
},
},
],
"depends_on": ["changelog"],
}
Expand Down
6 changes: 6 additions & 0 deletions changelog/unreleased/decomposedfs-check-error.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Bugfix: add missing error check in decomposedfs

During space creation the decomposedfs now checks for errors when trying to read the root node. This prevents a panic by no longer calling InternalPath on the node.

https://github.com/cs3org/reva/pull/3430
https://github.com/owncloud/ocis/issues/4961
9 changes: 5 additions & 4 deletions pkg/storage/utils/decomposedfs/spaces.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,12 @@ func (fs *Decomposedfs) CreateStorageSpace(ctx context.Context, req *provider.Cr
}

root, err := node.ReadNode(ctx, fs.lu, spaceID, spaceID, true) // will fall into `Exists` case below
if err == nil && root.Exists {
switch {
case err != nil:
return nil, err
case root.Exists:
return nil, errtypes.AlreadyExists("decomposedfs: spaces: space already exists")
}

if !fs.canCreateSpace(ctx, spaceID) {
case !fs.canCreateSpace(ctx, spaceID):
return nil, errtypes.PermissionDenied(spaceID)
}

Expand Down