From 9b549bd5f45eaa3f4e7a8788e41c2352b1605a0e Mon Sep 17 00:00:00 2001 From: Zhenguo Niu Date: Mon, 18 Dec 2017 13:42:58 +0800 Subject: [PATCH] Restrict url check conditions when creating with --raw --- pkg/kubectl/cmd/create.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/kubectl/cmd/create.go b/pkg/kubectl/cmd/create.go index e3340bcf228..5c00d69acd3 100644 --- a/pkg/kubectl/cmd/create.go +++ b/pkg/kubectl/cmd/create.go @@ -123,7 +123,7 @@ func (o *CreateOptions) ValidateArgs(cmd *cobra.Command, args []string) error { if len(o.FilenameOptions.Filenames) != 1 { return cmdutil.UsageErrorf(cmd, "--raw can only use a single local file or stdin") } - if strings.HasPrefix(o.FilenameOptions.Filenames[0], "http") { + if strings.Index(o.FilenameOptions.Filenames[0], "http://") == 0 || strings.Index(o.FilenameOptions.Filenames[0], "https://") == 0 { return cmdutil.UsageErrorf(cmd, "--raw cannot read from a url") } if o.FilenameOptions.Recursive {