wnfs-wg / rs-wnfs

Rust implementation of the WebNative FileSystem (WNFS) specification
https://github.com/wnfs-wg
Apache License 2.0
145 stars 23 forks source link

PrivateFile::stream_content doesn't honor the index for inline content #361

Open fabricedesre opened 1 year ago

fabricedesre commented 1 year ago

PrivateFile::stream_content() takes an index parameter that is passed to the private forest content when the file content is external. However in the case of inline content, the whole vector is yieled in https://github.com/wnfs-wg/rs-wnfs/blob/6df4a6bf89a71010b7bc15c132512da979ebc438/wnfs/src/private/file.rs#L489

I think we should instead yield data[index..].to_vec()

matheus23 commented 1 year ago

Sorry. The index actually refers to the block index, not the byte index. We should fix the docs and provide an abstraction on top that does the conversation between block and byte indices.