diff --git a/packages/ipfs-core/src/components/add-all/index.js b/packages/ipfs-core/src/components/add-all/index.js index 5d14f5685d..2eb11547cc 100644 --- a/packages/ipfs-core/src/components/add-all/index.js +++ b/packages/ipfs-core/src/components/add-all/index.js @@ -189,7 +189,7 @@ function pinFile (pin, opts) { for await (const file of source) { // Pin a file if it is the root dir of a recursive add or the single file // of a direct add. - const isRootDir = !file.path?.includes('/') + const isRootDir = !(file.path && file.path.includes('/')) const shouldPin = (opts.pin == null ? true : opts.pin) && isRootDir && !opts.onlyHash if (shouldPin) {