Skip to content
This repository has been archived by the owner on Feb 12, 2024. It is now read-only.

jsipfs recursive add with duplicate empty files fails #3255

Closed
koivunej opened this issue Aug 29, 2020 · 0 comments · Fixed by #3260
Closed

jsipfs recursive add with duplicate empty files fails #3255

koivunej opened this issue Aug 29, 2020 · 0 comments · Fixed by #3260
Labels
kind/bug A bug in existing code (including security flaws)

Comments

@koivunej
Copy link
Contributor

koivunej commented Aug 29, 2020

  • Version:
$ jsipfs version --all
js-ipfs version: 0.49.0-e7396bc883ad5a6620e2f7bc32e7baf4e636e230
interface-ipfs-core version: ^0.139.0
ipfs-http-client version: ^46.0.0
Repo version: 8
System version: x64/linux
Node.js version: v13.14.0
Commit: e7396bc883ad5a6620e2f7bc32e7baf4e636e230
  • Platform:
$ uname -a
Linux joonas-t495 5.3.0-64-generic #58-Ubuntu SMP Fri Jul 10 19:33:51 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
  • Subsystem:

Not sure.

Severity:

Medium, maybe high. Degraded to low when I realized that the files need to be empty.

Description:

$ jsipfs add -r minimal/
Invalid version, must be a number equal to 1 or 0

Steps to reproduce the error:

$ mkdir -p minimal/sub
$ touch minimal/empty minimal/sub/empty
$ jsipfs add -r minimal
Invalid version, must be a number equal to 1 or 0
$ jsipfs add -r --block-write-concurrency=1 --file-import-concurrency=1 minimal; echo $?
Invalid version, must be a number equal to 1 or 0
1

Error does not happen with:

$ mkdir -p minimal/sub
$ echo foobar > minimal/foobar
$ echo foobar > minimal/sub/foobar
$ jsipfs add -r minimal; echo $?
added QmRgutAxd8t7oGkSm4wmeuByG6M51wcTso6cubDdQtuEfL minimal/foobar
added QmRgutAxd8t7oGkSm4wmeuByG6M51wcTso6cubDdQtuEfL minimal/sub/foobar
added QmYmmkD3dGZjuozuqSzDYjU4ZyhAgc4T4P4SUgY6qjzBi8 minimal/sub
added Qmf8HQdjEJjvq7L8Rk5Nv26xsWrraZum5cRY5bmgsMqewe minimal
0

Hit while testing the pinning out and developing it on the rust-ipfs side. Not sure if this is just a cli bug, but it's easy to reproduce.

Might be related, if you drop the -r from jsipfs add and retry:

$ jsipfs add minimal ; echo $?
The user aborted a request.
1
@koivunej koivunej added the need/triage Needs initial labeling and prioritization label Aug 29, 2020
@koivunej koivunej changed the title jsipfs add with duplicate files fails jsipfs recursive add with duplicate files fails Aug 29, 2020
@koivunej koivunej changed the title jsipfs recursive add with duplicate files fails jsipfs recursive add with duplicate empty files fails Aug 29, 2020
@achingbrain achingbrain added kind/bug A bug in existing code (including security flaws) and removed need/triage Needs initial labeling and prioritization labels Sep 2, 2020
achingbrain added a commit that referenced this issue Sep 2, 2020
When a file is empty the progress event will have a `Bytes` property
that is `0` so test if the property is not undefined rather than if
it is truthy.

Fixes #3255
achingbrain added a commit that referenced this issue Sep 2, 2020
When a file is empty the progress event will have a `Bytes` property
that is `0` so test if the property is not undefined rather than if
it is truthy.

Fixes #3255
SgtPooki referenced this issue in ipfs/js-kubo-rpc-client Aug 18, 2022
When a file is empty the progress event will have a `Bytes` property
that is `0` so test if the property is not undefined rather than if
it is truthy.

Fixes #3255
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
kind/bug A bug in existing code (including security flaws)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants