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

fixed couple of smaller space lookup issues #3982

Merged
merged 2 commits into from
Jun 19, 2023
Merged

fixed couple of smaller space lookup issues #3982

merged 2 commits into from
Jun 19, 2023

Conversation

rhafer
Copy link
Contributor

@rhafer rhafer commented Jun 15, 2023

Fix ListFolder to have the correct SpaceRoot in the results

ListFolder passed the wrong node for the SpaceRoot parameter to ReadNode()

also:
Fix ReadNode call in NodeFromSpaceID()

Pass the correct ID (the spaced id) to ReadNode().

@rhafer rhafer requested review from a team, labkode, ishank011 and glpatcern as code owners June 15, 2023 14:25
@rhafer rhafer changed the title fixed couple of smaller space lookup issue fixed couple of smaller space lookup issues Jun 15, 2023
@@ -164,7 +164,7 @@ func Pathify(id string, depth, width int) string {

// NodeFromSpaceID converts a resource id without an opaque id into a Node
func (lu *Lookup) NodeFromSpaceID(ctx context.Context, id *provider.ResourceId) (n *node.Node, err error) {
node, err := node.ReadNode(ctx, lu, id.SpaceId, id.OpaqueId, false, nil, false)
node, err := node.ReadNode(ctx, lu, id.SpaceId, id.SpaceId, false, nil, false)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The change itself looks good to me, but how about changing the signature of NodeFromSpaceID to

func (lu *Lookup) NodeFromSpaceID(ctx context.Context, spaceID string) (n *node.Node, err error)

while we're at it to better reflect what's going on?
The current signature poses the risk that it's gonna be used wrongly in the future when people shove in a resource ID and expect the opaque id to be considered.

rhafer added 2 commits June 15, 2023 17:20
Pass the correct ID (the spaced id) to ReadNode(). Also fix the
signature of the NodeFromSpaceID method to make it more obvious that
just needs a Resource ID.
ListFolder passed the wrong node for the SpaceRoot parameter to ReadNode()
@rhafer rhafer merged commit 9a3c4a3 into cs3org:edge Jun 19, 2023
rhafer added a commit to rhafer/ocis that referenced this pull request Jun 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants