mirror of
https://github.com/optim-enterprises-bv/kubernetes.git
synced 2025-11-03 19:58:17 +00:00
Restrict url check conditions when creating with --raw
This commit is contained in:
@@ -123,7 +123,7 @@ func (o *CreateOptions) ValidateArgs(cmd *cobra.Command, args []string) error {
|
|||||||
if len(o.FilenameOptions.Filenames) != 1 {
|
if len(o.FilenameOptions.Filenames) != 1 {
|
||||||
return cmdutil.UsageErrorf(cmd, "--raw can only use a single local file or stdin")
|
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")
|
return cmdutil.UsageErrorf(cmd, "--raw cannot read from a url")
|
||||||
}
|
}
|
||||||
if o.FilenameOptions.Recursive {
|
if o.FilenameOptions.Recursive {
|
||||||
|
|||||||
Reference in New Issue
Block a user