Skip to content

Add method returns a list on adding one file #133

@khssnv

Description

@khssnv

Adding one file user expects dict-type return (unfolded from original list-type response by stream decorer), but if ipfs provider proceed request with error (even it's not critical) he got a list like its shown below.

>>> ipfsapi.connect('http://127.0.0.1', 5001).add('./myfile')
[{'Name': 'myfile', 'Hash': 'QmbFMke1KXqnYyBBWxB74N4c5SBnJMVAiMNRcGu6x1AwQH', 'Size': '6'},
{'Message': 'cannot store pin state: write /var/lib/ipfs/datastore/000014.log: no space left on device', 'Code': 0, 'Type': 'error'}]

If user adding a directory he also get a list longer than expected.

>>> ipfsapi.connect('http://127.0.0.1', 5001).add('./mydir')
[{'Name': 'mydir/myfile2', 'Hash': 'QmbFMke1KXqnYyBBWxB74N4c5SBnJMVAiMNRcGu6x1AwQH', 'Size': '6'},
{'Name': 'mydir/myfile1', 'Hash': 'QmbFMke1KXqnYyBBWxB74N4c5SBnJMVAiMNRcGu6x1AwQH', 'Size': '6'},
{'Name': 'mydir', 'Hash': 'Qmaqk3vCjaXMJf6HqeV7aTRvHZpELsJNRWU7WgFJ4Z9M9X', 'Size': '114'},
{'Message': 'cannot store pin state: write /var/lib/ipfs/datastore/000014.log: no space left on device', 'Code': 0, 'Type': 'error'}]

Maybe there is a better place for error messages to let add return expected type / size?

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions