Skip to content

Commit

Permalink
fix possible nil pointer exception (#2558)
Browse files Browse the repository at this point in the history
  • Loading branch information
micbar authored Feb 16, 2022
1 parent a765314 commit 67204fe
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
1 change: 1 addition & 0 deletions changelog/unreleased/remove-base64-encoding-of-ids.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ Change: Do not encode webDAV ids to base64
We removed the base64 encoding of the IDs and use the format <storageID>!<opaqueID> with a `!` delimiter. As a reserved delimiter it is URL safe. The IDs will be XML and JSON encoded as necessary.

https://github.com/cs3org/reva/pull/2542
https://github.com/cs3org/reva/pull/2558
10 changes: 10 additions & 0 deletions pkg/storage/utils/decomposedfs/spaces.go
Original file line number Diff line number Diff line change
Expand Up @@ -419,10 +419,20 @@ func (fs *Decomposedfs) UpdateStorageSpace(ctx context.Context, req *provider.Up
}
if image, ok := space.Opaque.Map["image"]; ok {
imageID := resourceid.OwnCloudResourceIDUnwrap(string(image.Value))
if imageID == nil {
return &provider.UpdateStorageSpaceResponse{
Status: &v1beta11.Status{Code: v1beta11.Code_CODE_NOT_FOUND, Message: "decomposedFS: space image resource not found"},
}, nil
}
metadata[xattrs.SpaceImageAttr] = imageID.OpaqueId
}
if readme, ok := space.Opaque.Map["readme"]; ok {
readmeID := resourceid.OwnCloudResourceIDUnwrap(string(readme.Value))
if readmeID == nil {
return &provider.UpdateStorageSpaceResponse{
Status: &v1beta11.Status{Code: v1beta11.Code_CODE_NOT_FOUND, Message: "decomposedFS: space readme resource not found"},
}, nil
}
metadata[xattrs.SpaceReadmeAttr] = readmeID.OpaqueId
}
}
Expand Down

0 comments on commit 67204fe

Please sign in to comment.