-
Notifications
You must be signed in to change notification settings - Fork 1.2k
feat: add wrapWithDirectory flag to files.add et al #1290
Conversation
@@ -245,7 +247,7 @@ exports.add = { | |||
ipfs.files.addPullStream(options), | |||
pull.map((file) => { | |||
return { | |||
Name: file.path ? file.path : file.hash, | |||
Name: file.path, //addPullStream already turned this into a hash if it wanted to |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was already being done in addPullStream so I removed it from here, because addPullStream has a new case where it is leaving path as an empty string and wants it that way.
This has been updated w/ the interface and api updates. |
cb(null, { | ||
path: file.path || b58Hash, | ||
path: opts.wrapWithDirectory ? file.path.substring(WRAPPER.length) : (file.path || b58Hash), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I admittedly don't know 100% of what's going on here or why the go implementation behaves this way but having it return an empty path for the wrapper directory feels like an anti-pattern.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was explained as "the wrapper is the root"
|
needs ipfs/js-ipfsd-ctl#227 |
Any progress on this? Currently needed to have CI passing normally again, as feature was added in interface-ipfs-core and now used for master branch in ipfs/js-ipfs |
Continuing here: #1329 |
For #1178
This removes the
-w
flag code from the cli and implements the exact same functionality in the core files component.There is a
throw
in here that is being eaten (i.e. I did not see it bubble back up when testing this locally on the cli) and I do not know how to make this work, help would be appreciated here.The reason for the throw is that this feature assumes that you gave a path name with which to wrap in a directory.