Skip to content

Commit

Permalink
allow pulling with empty name
Browse files Browse the repository at this point in the history
Signed-off-by: Shiwei Zhang <[email protected]>
  • Loading branch information
shizhMSFT committed Mar 31, 2021
1 parent 0e3fc18 commit f0920ba
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions cmd/oras/pull.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ type pullOptions struct {
targetRef string
allowedMediaTypes []string
allowAllMediaTypes bool
allowEmptyName bool
keepOldFiles bool
pathTraversal bool
output string
Expand Down Expand Up @@ -70,6 +71,7 @@ Example - Pull files with local cache:

cmd.Flags().StringArrayVarP(&opts.allowedMediaTypes, "media-type", "t", nil, "allowed media types to be pulled")
cmd.Flags().BoolVarP(&opts.allowAllMediaTypes, "allow-all", "a", false, "allow all media types to be pulled")
cmd.Flags().BoolVarP(&opts.allowEmptyName, "allow-empty-name", "", false, "allow pulling files with empty name")
cmd.Flags().BoolVarP(&opts.keepOldFiles, "keep-old-files", "k", false, "do not replace existing files when pulling, treat them as errors")
cmd.Flags().BoolVarP(&opts.pathTraversal, "allow-path-traversal", "T", false, "allow storing files out of the output directory")
cmd.Flags().StringVarP(&opts.output, "output", "o", "", "output directory")
Expand Down Expand Up @@ -114,6 +116,9 @@ func runPull(opts pullOptions) error {
}
pullOpts = append(pullOpts, oras.WithContentProvideIngester(cachedStore))
}
if opts.allowEmptyName {
pullOpts = append(pullOpts, oras.WithPullEmptyNameAllowed())
}

desc, artifacts, err := oras.Pull(ctx, resolver, opts.targetRef, store, pullOpts...)
if err != nil {
Expand Down

0 comments on commit f0920ba

Please sign in to comment.