massalabs / DeWeb

On-chain Decentralized Web Gateway
MIT License
2 stars 1 forks source link

Define what to do if file is not initialized and we upload it #146

Open Ben-Rey opened 1 month ago

damip commented 4 days ago

can you give more details on this ?

Ben-Rey commented 6 hours ago

The aim was to check whether the case where we tried to download a file that had not been initialized in the init function was handled correctly.

Here the Storage.set will fail because fileChunkKey(hashLocation, index) wont exist. Storage.set(fileChunkKey(hashLocation, index), chunk); will fail if fonction in _setFileChunk function.

We could improve error message by doing something like: assert(Storage.has(fileChunkKey(hashLocation, index), chunk), 'this file was not initialized, location storage key not found')