specs icon indicating copy to clipboard operation
specs copied to clipboard

UnixFS duplicate paths during import

Open achingbrain opened this issue 5 years ago • 2 comments

Following on from https://github.com/ipfs/js-ipfs/issues/2622

You can have the situation where a user tries to build a UnixFS directory with duplicate paths:

await ipfs.add([{
  path: 'folder/file',
  content: Buffer.from('hello world')
}, {
  path: 'folder/file',
  content: Buffer.from('another hello world')
}])

Current behaviour is last-file-wins for both go-IPFS and js-IPFS.

Should this be the case or should they error? The API makes it trivial to do this kind of operation, but file systems typically do not support entries with duplicate names.

Once there is an agreement, this should be documented in the spec order for DAGs to be recreated without reference to go-IPFS or js-IPFS.

achingbrain avatar Feb 05 '20 11:02 achingbrain

@achingbrain reference: https://github.com/ipfs/go-ipfs/issues/4292

ribasushi avatar Feb 05 '20 14:02 ribasushi

I'd like to make it an error. I'd also like to enforce stable directory orders and check for duplicates when reading directories.

Stebalien avatar Feb 05 '20 15:02 Stebalien