Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ipfs get drops containing directory structure in output when <ipfs_path> contains trailing slash ('/') #4720

Closed
yuri-sevatz opened this issue Feb 19, 2018 · 2 comments · Fixed by #4743

Comments

@yuri-sevatz
Copy link

yuri-sevatz commented Feb 19, 2018

Version information:

ipfs version 0.4.13

Type:

Bug

Description:

ipfs init
ipfs daemon &
mkdir -p ~/test/test2/hello/
echo "Aperture Science" >> ~/test/test2/hello/world.txt
ipfs add -r -w ~/test
ipfs get -o ~/Downloads/test /ipfs/`ipfs id -f='<id>'`/test/
ls -R ~/Downloads/test

Results in:

/home/ninja/Downloads/test:
hello

/home/ninja/Downloads/test/hello:
world.txt

Yet leaving out the trailing slash after the path portion at the end of the get command:

mkdir -p ~/test/test2/hello/
echo "Aperture Science" >> ~/test/test2/hello/world.txt
ipfs add -r -w ~/test
ipfs get -o ~/Downloads/test /ipfs/`ipfs id -f='<id>'`/test
ls -R ~/Downloads/test

Results in:

/home/ninja/Downloads/test:
test2

/home/ninja/Downloads/test/test2:
hello

/home/ninja/Downloads/test/test2/hello:
world.txt

It seems leaving out the trailing slash after the path in the ipfs get command allows the folder structure to download correctly, but adding one in causes ipfs get to squash subfolders of the parent folder together right in your output path.

This is probably quite dangerous and counter-intuitive.

@yuri-sevatz yuri-sevatz changed the title ipfs get drops parent directory in output when <ipfs_path> contains trailing slash ('/') ipfs get drops containing directory structure in output when <ipfs_path> contains trailing slash ('/') Feb 19, 2018
@schomatis
Copy link
Contributor

I can reproduce this. The function DagArchive that prepares the output does not clean the path as the resolver does in Segments.

@schomatis
Copy link
Contributor

@yuri-sevatz Could you try that again with #4743?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants