Skip to content

Commit

Permalink
bugfix: pouch pull should handle space input as an error (#1753)
Browse files Browse the repository at this point in the history
Signed-off-by: xiechengsheng <[email protected]>
  • Loading branch information
xiechengsheng authored and Wei Fu committed Jul 20, 2018
1 parent 56dd0f5 commit 13667d3
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
6 changes: 5 additions & 1 deletion cli/pull.go
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,11 @@ func pullMissingImage(ctx context.Context, apiClient client.CommonAPIClient, ima
}
}

namedRef, _ := reference.Parse(image)
namedRef, err := reference.Parse(image)
if err != nil {
return err
}

namedRef = reference.TrimTagForDigest(reference.WithDefaultTagIfMissing(namedRef))

var name, tag string
Expand Down
5 changes: 5 additions & 0 deletions pkg/reference/parse_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,11 @@ func TestParse(t *testing.T) {
tag: "1669a6aa7350e1cdd28f972ddad5aceba2912f589f19a090ac",
},
err: nil,
}, {
name: "Contains space input",
input: " ",
expected: nil,
err: ErrInvalid,
},
} {
ref, err := Parse(tc.input)
Expand Down

0 comments on commit 13667d3

Please sign in to comment.