Commit 9b549bd5 authored by Zhenguo Niu's avatar Zhenguo Niu

Restrict url check conditions when creating with --raw

parent c933067c
......@@ -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 {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment