diff --git a/packages/ipfs-unixfs-exporter/CHANGELOG.md b/packages/ipfs-unixfs-exporter/CHANGELOG.md index d5564f82..ab87ec53 100644 --- a/packages/ipfs-unixfs-exporter/CHANGELOG.md +++ b/packages/ipfs-unixfs-exporter/CHANGELOG.md @@ -1,3 +1,16 @@ +## [ipfs-unixfs-exporter-v7.0.7](https://github.com/ipfs/js-ipfs-unixfs/compare/ipfs-unixfs-exporter-v7.0.6...ipfs-unixfs-exporter-v7.0.7) (2022-04-26) + + +### Bug Fixes + +* do not add metadata to leaves ([#193](https://github.com/ipfs/js-ipfs-unixfs/issues/193)) ([f5d3a67](https://github.com/ipfs/js-ipfs-unixfs/commit/f5d3a670e163632913229a1b75ec12a2d6847326)) + + +### Trivial Changes + +* switch to auto-release ([#208](https://github.com/ipfs/js-ipfs-unixfs/issues/208)) ([99386e6](https://github.com/ipfs/js-ipfs-unixfs/commit/99386e61979214e8ef79915800a6ed7154938342)) +* update readmes ([#188](https://github.com/ipfs/js-ipfs-unixfs/issues/188)) ([273a141](https://github.com/ipfs/js-ipfs-unixfs/commit/273a141b5ee3805bd0ef2dc8ed7870f8c6c8a820)) + # Change Log All notable changes to this project will be documented in this file. diff --git a/packages/ipfs-unixfs-exporter/test/importer.spec.js b/packages/ipfs-unixfs-exporter/test/importer.spec.js index 2639f570..192557fd 100644 --- a/packages/ipfs-unixfs-exporter/test/importer.spec.js +++ b/packages/ipfs-unixfs-exporter/test/importer.spec.js @@ -1073,6 +1073,24 @@ strategies.forEach((strategy) => { expect(child).to.have.property('unixfs') expect(child).to.not.have.nested.property('unixfs.mtime') }) + + it('should add metadata to the root node of a small file without raw leaves', async () => { + this.timeout(60 * 1000) + + const mode = 511 + + const entries = await all(importer([{ + path: '/foo/file1.txt', + content: asAsyncIterable(smallFile), + mode + }], block, { + rawLeaves: false + })) + + const root = await exporter(entries[0].cid, block) + + expect(root).to.have.nested.property('unixfs.mode', 511) + }) }) }) diff --git a/packages/ipfs-unixfs-importer/CHANGELOG.md b/packages/ipfs-unixfs-importer/CHANGELOG.md index a77decc4..f872931d 100644 --- a/packages/ipfs-unixfs-importer/CHANGELOG.md +++ b/packages/ipfs-unixfs-importer/CHANGELOG.md @@ -1,3 +1,10 @@ +## [ipfs-unixfs-importer-v9.0.8](https://github.com/ipfs/js-ipfs-unixfs/compare/ipfs-unixfs-importer-v9.0.7...ipfs-unixfs-importer-v9.0.8) (2022-05-04) + + +### Bug Fixes + +* metadata on small files without raw leaves ([#212](https://github.com/ipfs/js-ipfs-unixfs/issues/212)) ([bef09cd](https://github.com/ipfs/js-ipfs-unixfs/commit/bef09cdb143808305d7947f57eba3aac33298c23)) + ## [ipfs-unixfs-importer-v9.0.7](https://github.com/ipfs/js-ipfs-unixfs/compare/ipfs-unixfs-importer-v9.0.6...ipfs-unixfs-importer-v9.0.7) (2022-04-26) diff --git a/packages/ipfs-unixfs-importer/src/dag-builder/file/index.js b/packages/ipfs-unixfs-importer/src/dag-builder/file/index.js index f8ef36cb..100a9500 100644 --- a/packages/ipfs-unixfs-importer/src/dag-builder/file/index.js +++ b/packages/ipfs-unixfs-importer/src/dag-builder/file/index.js @@ -78,7 +78,7 @@ const reduce = (file, blockstore, options) => { if (leaves.length === 1 && leaves[0].single && options.reduceSingleLeafToSelf) { const leaf = leaves[0] - if (leaf.cid.code === rawCodec.code && (file.mtime !== undefined || file.mode !== undefined)) { + if (file.mtime !== undefined || file.mode !== undefined) { // only one leaf node which is a buffer - we have metadata so convert it into a // UnixFS entry otherwise we'll have nowhere to store the metadata let buffer = await blockstore.get(leaf.cid)