After experiencieng issues with infura hashes not matching the hashes from other pinners i looked a bit deeper into the issue to understand what is happening.
Test case is the following directory structure:
public/:
root.txt sub
public/sub:
sub1.txt sub2.txt subsub
public/sub/subsub:
subsub1.txt subsub2.txt
Then i tried to upload with infura and dappnode pinner, and check the response from api.addFromFs in pinners/infura.js and pinners/dappnode.js (via debugger):
Obviously, the responses are different. Dappnode response object contains all files, with the root folder element being the last element. Infura response object contains just one (random?) file from the directory.
While the root cause of this issue might be instability of Infura service (it also took about 20 seconds to get a response from infura API at all, so they clearly had problems at this time), this error needs to result in ipfs-deploy exiting with an error instead of providing wrong results.
In only had a brief look so far at the implementation, but I'm wondering if this needs to be investigated more inside ipfs-http-client? After all we're just using their "addFromFs" API.
After experiencieng issues with infura hashes not matching the hashes from other pinners i looked a bit deeper into the issue to understand what is happening.
Test case is the following directory structure:
Then i tried to upload with infura and dappnode pinner, and check the response from
api.addFromFs
inpinners/infura.js
andpinners/dappnode.js
(via debugger):Response from dappnode pinner:
Response from infura pinner:
Obviously, the responses are different. Dappnode response object contains all files, with the root folder element being the last element. Infura response object contains just one (random?) file from the directory.
While the root cause of this issue might be instability of Infura service (it also took about 20 seconds to get a response from infura API at all, so they clearly had problems at this time), this error needs to result in ipfs-deploy exiting with an error instead of providing wrong results.
In only had a brief look so far at the implementation, but I'm wondering if this needs to be investigated more inside ipfs-http-client? After all we're just using their "addFromFs" API.
Edit/addendum: Looking at https://github.com/ipfs/interface-js-ipfs-core/blob/master/SPEC/FILES.md#addfromfs there is no mention of a specifc ordering of the results. So the current approach of assuming that the last array element is the root node seems quite dangerous.