Skip to content
This repository has been archived by the owner on Feb 12, 2024. It is now read-only.

Fix ipfs.ls() for a single file object #3440

Merged
merged 5 commits into from
Dec 11, 2020
Merged

Conversation

ikreymer
Copy link
Contributor

This fixes a typo where ipfs.ls() returns instead of yielding from a generator.
The result is that ipfs.ls() does not work when the path is a file. I think this should fix it, with ls returning a generator with a single file result.

(Note: I wanted to add a test but could not find where this command is being tested).

@welcome
Copy link

welcome bot commented Dec 10, 2020

Thank you for submitting this PR!
A maintainer will be here shortly to review it.
We are super grateful, but we are also overloaded! Help us by making sure that:

  • The context for this PR is clear, with relevant discussion, decisions
    and stakeholders linked/mentioned.

  • Your contribution itself is clear (code comments, self-review for the
    rest) and in its best form. Follow the code contribution
    guidelines

    if they apply.

Getting other community members to do a review would be great help too on complex PRs (you can ask in the chats/forums). If you are unsure about something, just leave us a comment.
Next steps:

  • A maintainer will triage and assign priority to this PR, commenting on
    any missing things and potentially assigning a reviewer for high
    priority items.

  • The PR gets reviews, discussed and approvals as needed.

  • The PR is merged by maintainers when it has been approved and comments addressed.

We currently aim to provide initial feedback/triaging within two business days. Please keep an eye on any labelling actions, as these will indicate priorities and status of your contribution.
We are very grateful for your contribution!

@achingbrain
Copy link
Member

Thanks for submitting this, great catch & the fix looks good.

The tests for this part of the API live here: https://github.com/ipfs/js-ipfs/blob/master/packages/interface-ipfs-core/src/ls.js - could you please add a test for this and I'll get a patch release out.

@achingbrain
Copy link
Member

Thanks for adding the tests, I added a couple more and fixed up the breakage when invoking the api over http.

@achingbrain achingbrain merged commit b40925a into ipfs:master Dec 11, 2020
achingbrain added a commit that referenced this pull request Dec 11, 2020
This fixes a typo where `ipfs.ls()` returns instead of yielding from a generator.

The result is that ipfs.ls() does not work when the path is a file. I think this
should fix it, with `ls` returning a generator with a single file result.

Co-authored-by: achingbrain <alex@achingbrain.net>
shaista1519 added a commit to shaista1519/js-ipfs that referenced this pull request Dec 12, 2020
fix: fix ipfs.ls() for a single file object (ipfs#3440)
SgtPooki referenced this pull request in ipfs/js-kubo-rpc-client Aug 18, 2022
This fixes a typo where `ipfs.ls()` returns instead of yielding from a generator.

The result is that ipfs.ls() does not work when the path is a file. I think this
should fix it, with `ls` returning a generator with a single file result.

Co-authored-by: achingbrain <alex@achingbrain.net>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants