'Irregular behaviour of ipfs.object.patch.addLink api of js-ipfs
I am trying to link a hosted IPFS object to a directory using the ipfs.object.patch.addLink command but it is showing irregular behaviour.
I have added a directory named abcd2 onto IPFS. This directory contains a file named file.html. While adding I am wrapping it under a directory, so the new structure is
"" <- root directory
|
---- abcd2
|
---- file.html
I have added another file to ipfs named a.txt. I want to link a.txt to the root folder of the directory.
So the structure than should become ,
""
|
---- a.txt
---- abcd2
|
---- file.html
To achieve this, I am running the command,
const cidnew = await ipfs.object.patch.addLink(<CID of root directory>, {
Name: <name to keep of the file to link>,
Tsize: <size of the file>,
Hash: <hash of the file>
})
When I keep the name of the file as "a.txt" or "ab.txt" or "abc.txt" or "abcd.txt" is throws the following error,
HTTPError: Failed to add link to object: Invalid DAG-PB form (links must be sorted by Name bytes)
When I use any other name for the same file it works fine. I am using jsipfs for my implementation.
Does anyone know the reason and solution for this?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
