Ipfs-companion: Add support for wrapping quick uploads in a directory.

Created on 30 Dec 2017  ยท  3Comments  ยท  Source: ipfs/ipfs-companion

Maybe in the form of a checkbox or something in the quick upload UI. Would be nice for my uses because if I share a file to another user using a public gateway the filename is not preserved when they try and save the file. This is a bigger problem on Windows because it relies so much on file extensions.

kinenhancement exintermediate statuin-progress

Most helpful comment

Ok, so I want to give a go at this one ๐Ÿ‘

So I will try to summarize the current status:

  • The Files.add function doesn't implement the wrap-with-directoryoption.
  • In go-ipfs this functionality is implemented in the _HTTP API_ and _CLI_.
  • In js-ipfs this functionality is only implemented in _CLI_. (missing _HTTP API_ and _Core_).

So the following steps are needed:

I have a working implementation of this option in js-ipfs _HTTP API_, and I'm working on adding it to js-ipfs _Core_ also.

@lidel from an UX perspective do you think the checkbox field that @falsechicken mentioned is a good option, or could this functionality be activated by default?

All 3 comments

Ok, so I want to give a go at this one ๐Ÿ‘

So I will try to summarize the current status:

  • The Files.add function doesn't implement the wrap-with-directoryoption.
  • In go-ipfs this functionality is implemented in the _HTTP API_ and _CLI_.
  • In js-ipfs this functionality is only implemented in _CLI_. (missing _HTTP API_ and _Core_).

So the following steps are needed:

I have a working implementation of this option in js-ipfs _HTTP API_, and I'm working on adding it to js-ipfs _Core_ also.

@lidel from an UX perspective do you think the checkbox field that @falsechicken mentioned is a good option, or could this functionality be activated by default?

Plan A

@nunofmn sounds good to me ๐Ÿ‘ the summary and list of steps are very helpful, thanks!
If you are able to add it to the API, that would be beneficial to other projects using js-ipfs-api.
The task is yours โ€“ go for it! ๐Ÿš€

Plan B

Just for the record, here is a backup plan, if extending API turns out to be not feasible:

upload file the old way + assemble wrapping directory manually via object API:

  • file add โ†’ <file_cid>
  • object new unixfs-dir โ†’ <dir_cid>
  • object path <dir_cid> add-link <filename> <file_cid> โ†’ <dir_with_file_cid>
  • pin <dir_with_file_cid>

Checkbox for wrapping file with directory

I think we should have an explicit checkbox on the bottom of the upload form.
And it should be checked by default because most of users will want to preserve file name.

Reasons for preserving file name by default:

  • better UX for receiver: file type can be infered from file name or extension, looks less scary
  • various systems will not load remote content unless URL ends with specific extension
  • solves false-positives of mime-type detection when opened in older browsers (eg. SVG being rendered as XML tree etc)

FYI this feature just landed in beta channel: v2.2.2.9320. Implementation details in PR https://github.com/ipfs-shipyard/ipfs-companion/pull/479.
Big thank you to everyone who contributed necessary changes to upstream libs and specs.

Embedded node does not support it yet, but that will be tracked in #482.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

lidel picture lidel  ยท  3Comments

lidel picture lidel  ยท  5Comments

lidel picture lidel  ยท  4Comments

flowpoint picture flowpoint  ยท  3Comments

lidel picture lidel  ยท  4Comments