From 054fa1d213b150ea0ae6c414e80191091eaa6255 Mon Sep 17 00:00:00 2001 From: Billy Zha <515363446@qq.com> Date: Wed, 18 May 2022 15:35:26 +0800 Subject: [PATCH] Remove media type options for pull operation (#387) Signed-off-by: Billy Zha --- cmd/oras/pull.go | 25 +++++++------------------ 1 file changed, 7 insertions(+), 18 deletions(-) diff --git a/cmd/oras/pull.go b/cmd/oras/pull.go index fd3a13394..42d41225d 100644 --- a/cmd/oras/pull.go +++ b/cmd/oras/pull.go @@ -18,15 +18,13 @@ import ( ) type pullOptions struct { - targetRef string - allowedMediaTypes []string - allowAllMediaTypes bool - keepOldFiles bool - pathTraversal bool - output string - manifestConfigRef string - verbose bool - cacheRoot string + targetRef string + keepOldFiles bool + pathTraversal bool + output string + manifestConfigRef string + verbose bool + cacheRoot string debug bool configs []string @@ -72,8 +70,6 @@ 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.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") @@ -96,12 +92,6 @@ func runPull(opts pullOptions) error { } else if !opts.verbose { ctx = ctxo.WithLoggerDiscarded(ctx) } - if opts.allowAllMediaTypes { - opts.allowedMediaTypes = nil - } else if len(opts.allowedMediaTypes) == 0 { - opts.allowedMediaTypes = []string{content.DefaultBlobMediaType, content.DefaultBlobDirMediaType} - } - resolver := newResolver(opts.username, opts.password, opts.insecure, opts.plainHTTP, opts.configs...) store := content.NewFileStore(opts.output) defer store.Close() @@ -109,7 +99,6 @@ func runPull(opts pullOptions) error { store.AllowPathTraversalOnWrite = opts.pathTraversal pullOpts := []oras.PullOpt{ - oras.WithAllowedMediaTypes(opts.allowedMediaTypes), oras.WithPullStatusTrack(os.Stdout), } if opts.cacheRoot != "" {