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

fix: get_node should return null on missing path #253

Merged
merged 3 commits into from
May 5, 2023

Conversation

appcypher
Copy link
Member

@appcypher appcypher commented May 3, 2023

Summary

rs-wnfs get_node fns in PublicDirectory and PrivateDirectory currently do not replicate the same behavior in webnative when a non-existent path segment is specified. It returns anErr(...) instead of a Ok(None) which translates to null on the js side.

This PR solves that although there is the little inconvenience that wasm-bindgen translates Ok(None) to undefined on the js side.

Test plan (required)

scripts/rs-wnfs.sh test

Closing issues

Fixes #222

@appcypher appcypher requested a review from a team as a code owner May 3, 2023 16:30
@appcypher appcypher changed the title Get Node Returns Null on Missing Path fix: get_node should return null on missing path May 3, 2023
@codecov
Copy link

codecov bot commented May 3, 2023

Codecov Report

Merging #253 (e1911d1) into main (bccc0ec) will increase coverage by 0.12%.
The diff coverage is 50.00%.

❗ Current head e1911d1 differs from pull request most recent head ef8052f. Consider uploading reports for the commit ef8052f to get more accurate results

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #253      +/-   ##
==========================================
+ Coverage   61.72%   61.84%   +0.12%     
==========================================
  Files          35       35              
  Lines        2662     2663       +1     
  Branches      655      655              
==========================================
+ Hits         1643     1647       +4     
+ Misses        566      563       -3     
  Partials      453      453              
Impacted Files Coverage Δ
wnfs/src/private/directory.rs 71.82% <50.00%> (+0.43%) ⬆️
wnfs/src/public/directory.rs 70.27% <50.00%> (+0.90%) ⬆️

... and 4 files with indirect coverage changes

Copy link
Member

@matheus23 matheus23 left a comment

Choose a reason for hiding this comment

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

LGTM! :) Just need to make newer clippy happy.

wnfs-wasm/src/fs/private/directory.rs Show resolved Hide resolved
@appcypher appcypher changed the title fix: get_node should return null on missing path fix!: get_node should return null on missing path May 5, 2023
@appcypher appcypher merged commit 5ed87fe into main May 5, 2023
@appcypher appcypher deleted the appcypher/get-node-result branch May 5, 2023 11:07
@github-actions github-actions bot mentioned this pull request May 5, 2023
@appcypher appcypher changed the title fix!: get_node should return null on missing path fix: get_node should return null on missing path May 5, 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.

getNode fails when multiple segments of the path do not exist
2 participants