From 775a2dde095130d53291f8b76fa9b19269c5840c Mon Sep 17 00:00:00 2001
From: semantic-release-bot <semantic-release-bot@martynus.net>
Date: Tue, 26 Apr 2022 08:32:35 +0000
Subject: [PATCH 1/3] chore(release): 7.0.7 [skip ci]

## [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))
---
 packages/ipfs-unixfs-exporter/CHANGELOG.md | 13 +++++++++++++
 1 file changed, 13 insertions(+)

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.

From bef09cdb143808305d7947f57eba3aac33298c23 Mon Sep 17 00:00:00 2001
From: Alex Potsides <alex@achingbrain.net>
Date: Wed, 4 May 2022 18:35:51 +0100
Subject: [PATCH 2/3] fix: metadata on small files without raw leaves (#212)

A file with metadata and without raw leaves should have the metadata preserved when the single leaf node is collapse to a root node.
---
 .../ipfs-unixfs-exporter/test/importer.spec.js | 18 ++++++++++++++++++
 .../src/dag-builder/file/index.js              |  2 +-
 2 files changed, 19 insertions(+), 1 deletion(-)

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/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)

From 6e7cf634f84c046343c0110e0039b73372a9a152 Mon Sep 17 00:00:00 2001
From: semantic-release-bot <semantic-release-bot@martynus.net>
Date: Wed, 4 May 2022 17:43:16 +0000
Subject: [PATCH 3/3] chore(release): 9.0.8 [skip ci]

## [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))
---
 packages/ipfs-unixfs-importer/CHANGELOG.md | 7 +++++++
 1 file changed, 7 insertions(+)

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)