boxo icon indicating copy to clipboard operation
boxo copied to clipboard

Single file preserve filename in ipfs kubo download in same directory

Open ofman opened this issue 1 year ago • 4 comments

If you want to preserve filename in ipfs kubo there is a suggestion in docs and forums to wrap a folder around the file as a workaround but when you want to save a single file in the same directory you get "ErrPathEistsOverwrite" error ("path already exists and overwriting is not allowed") because in github.com/ipfs/[email protected]/files/filewriter.go file 38 line there is os.Mkdir(fpath, 0o777) function. Can you fix this either by letting single file case preserve filenames in ipfs or by not calling os.Mkdir if there is only 1 file in directory please? Thanks!

ofman avatar Dec 07 '23 16:12 ofman

@ofman thank you for reporting, but it is a bit unclear what is the problem. Do you mind providing a code snippet that reproduces the issue?

lidel avatar Dec 11 '23 14:12 lidel

@ofman thank you for reporting, but it is a bit unclear what is the problem. Do you mind providing a code snippet that reproduces the issue?

@lidel I have created whole new repository just for ya! :) Here it is: https://github.com/ofman/filesharegocli Just go build and do basic usage steps then change shouldWorkButNot := false to shouldWorkButNot := true and you will see the error after go build and basic usage steps.

Basic usage in README.md and below: Use flags -f "example.jpg" or -c "exampleCid" to share files for example: Upload file (keep terminal window open/running to let others download): ./fsg -f go.sum Download file (open new terminal window): ./fsg -c /ipfs/QmX4zdEUtimXgxhpzv8jfFLqkuutNhmoNH987cH5RS67GM

P.S. Also see same issue for other brogrammer here: https://github.com/ipfs/boxo/issues/28

ofman avatar Dec 13 '23 20:12 ofman

@ofman It seems that what is needed is to add a "force-overwrite" flag to allow downloaded file(s) to replace any existing. Would that be a sufficient solution to this issue?

gammazero avatar Aug 20 '24 16:08 gammazero

Oops, seems like we needed more information for this issue, please comment with more details or this issue will be closed in 7 days.

github-actions[bot] avatar Aug 28 '24 00:08 github-actions[bot]