Skip to content

TypeError when adding a file from a multihash #45

@tomibennett

Description

@tomibennett

When a new file is instanciated from a multihash, then added, a check is missing.

We need to ensure the path is present before requesting Ipfs.

The check must be added here.

> Ipfs::File.new(multihash: 'QmWnkQNY81dasvJmCG933V2V6W8PBdvDBvfEPL4mq1GHzY').add
TypeError: no implicit conversion of nil into String
      [...]
/http/client.rb:161:in `make_request_body'
        from /Users/tom/.rbenv/versions/2.4.2/lib/ruby/gems/2.4.0/gems/http-2.2.2/lib/http/client.rb:30:in `request'
        from /Users/tom/dev/one_account/ruby-ipfs-api/lib/client.rb:30:in `call'
        from /Users/tom/dev/one_account/ruby-ipfs-api/lib/client.rb:41:in `execute'
        from /Users/tom/dev/one_account/ruby-ipfs-api/lib/file.rb:19:in `block in add'
        from /Users/tom/dev/one_account/ruby-ipfs-api/lib/file.rb:18:in `tap'
        from /Users/tom/dev/one_account/ruby-ipfs-api/lib/file.rb:18:in `add'
        from (irb):23
        from /Users/tom/.rbenv/versions/2.4.2/bin/irb:11:in `<main>'

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions