-
-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Don't use tar reader for '-C' flag #1354
Conversation
I think this LGTM. |
@rht i'm not sure about this. what if I want a gzipped raw file?
is possible. so should:
and thus i would expect
not
|
other people's thoughts? |
Ok my starting point is to investigate why
To bypass the problem, since it is already a .tar.gz stream, why not just use .tar.gz extension? Alternatively the only way for |
@rht ah, interesting.
that makes sense to me. if a I'm still not sold on
or something.
agree when |
338a413
to
7508e1f
Compare
This is now fixed. '-C' uses Though I don't know which one is more effective: bufio.NewReader + WriteTo, or just |
I figure that in unixfs/tar/reader.go, So, |
Could someone else CR this? i'm behind. maybe @wking @whyrusleeping @cryptix ? |
|
||
// getZip is equivalent to `ipfs getdag $hash | gzip` | ||
func getZip(ctx context.Context, node *core.IpfsNode, p string, compression int) (io.Reader, error) { | ||
pathToResolve := path.Path(p) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this should call path.ParsePath
so we can validate the input path
one comment above, otherwise LGTM. |
// Validate path string | ||
p, err := path.ParsePath(req.Arguments()[0]) | ||
if err != nil { | ||
res.SetError(fmt.Errorf("failed to validate path: %v", err), cmds.ErrNormal) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added path validation here.
LGTM |
@rht circleci didn't like it. have you rebased on new master? (it's always good to do so as keeps our branches closer) |
Currently `ipfs get -C <hash>` returns error even if <hash> is a file. This PR is for the case when the compress flag is enabled, use the dagreader directly and pipe to a gzip processor. License: MIT Signed-off-by: rht <rhtbot@gmail.com>
|
Now it passed circleci, but failed travis go-test because of ctx issue. The PR doesn't change any ctx related code, so should be fine. |
Great, thanks! LGTM |
Don't use tar reader for '-C' flag
Want to add |
Probably? |
Already in dfde18e. All usage of |
Currently
ipfs get -C <hash>
returns error even if is a file.This PR is for the case when the compress flag is enabled, always
archive the output before the compression.