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

getNode fails when multiple segments of the path do not exist #222

Closed
icidasset opened this issue Mar 29, 2023 · 2 comments · Fixed by #253
Closed

getNode fails when multiple segments of the path do not exist #222

icidasset opened this issue Mar 29, 2023 · 2 comments · Fixed by #253
Labels
bug Something isn't working

Comments

@icidasset
Copy link
Member

icidasset commented Mar 29, 2023

Calling getNode([ "top-dir", "nested-dir", "file" ]) will result in an error instead of returning null. Where "top-dir" exists, but "nested-dir" and "file" do not.

Given error:

Error: Cannot get node: Invalid WNFS path
@icidasset icidasset added the bug Something isn't working label Mar 29, 2023
@appcypher
Copy link
Member

How do you suggest we go about it?
You could use a workaround by handling the error or we can introduce a variant of getNode that returns null with invalid paths.

@matheus23
Copy link
Member

matheus23 commented Mar 31, 2023

Since get_node already returns a Result<Option<...>>, and that's Ok(None) if the last part of the path is missing, it should simply also return Ok(None) when any other path segment is missing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants