ipfs / ipfs/kubo

Multi file add does not work as I would expect

Open
#2,811 9 comments 0 reactions 0 assignees View on GitHub
kind/bug status/deferred topic/commands:add
Dominant language
Go
Stars
17.1k
Forks
3.2k
Avg merge
3d 18h
Merged PRs (30d)
11

Description

It seams that even if `-w` is not specified, files added via `ipfs add ...` are added to a mfs directory. As I see it this leads to two unexpected behaviors:

1) The command will fail if a file with the same name is added twice, even if they are separate files:

```
$ mkdir a b
$ echo "Hello World!" > a/hello
$ echo 'HELLO WORLD!' > b/hello
$ ipfs add a/hello b/hello
added QmfM2r8seH2GiRaC4esTjeraXEachRt8ZsSeGaWTPLyMoG hello
Error: directory already has entry by that name
```

2) The files are pinned indirectly via the created directory

```
$ mv b/hello b/hello2
$ ipfs add a/hello b/hello2
added QmfM2r8seH2GiRaC4esTjeraXEachRt8ZsSeGaWTPLyMoG hello
added QmemWc3tw1HEM5oTTE1bxwvjKkn1yGFKJF1zVCZXD5wXgi hello2
$ ipfs pin rm QmfM2r8seH2GiRaC4esTjeraXEachRt8ZsSeGaWTPLyMoG
Error: QmfM2r8seH2GiRaC4esTjeraXEachRt8ZsSeGaWTPLyMoG is pinned indirectly under QmXpzvr3QHQ2Yxwb264HsNQsASJkD7jLhFBArCy6DX5iKV
```

Without `-w` the behavior I would expect is that each file is added and pinned individually.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.