diff --git a/client.go b/client.go index 323eef9c3..ef7a28a72 100644 --- a/client.go +++ b/client.go @@ -394,7 +394,15 @@ func (c *Client) ExportCSV(ctx context.Context, index, frame, view string, slice return ErrIndexRequired } else if frame == "" { return ErrFrameRequired - } else if view != ViewInverse || view != ViewStandard { + } + foundView := false + for _, v := range []string{ViewInverse, ViewStandard} { + if view == v { + foundView = true + break + } + } + if foundView == false { return ErrInvalidView } diff --git a/ctl/export.go b/ctl/export.go index 8b2d6cd35..63266a8d6 100644 --- a/ctl/export.go +++ b/ctl/export.go @@ -49,13 +49,22 @@ func NewExportCommand(stdin io.Reader, stdout, stderr io.Writer) *ExportCommand // Run executes the export. func (cmd *ExportCommand) Run(ctx context.Context) error { logger := log.New(cmd.Stderr, "", log.LstdFlags) + foundView := false // Validate arguments. if cmd.Index == "" { return pilosa.ErrIndexRequired } else if cmd.Frame == "" { return pilosa.ErrFrameRequired - } else if cmd.View != pilosa.ViewStandard || cmd.View != pilosa.ViewInverse { + } + + for _, v := range []string{pilosa.ViewInverse, pilosa.ViewStandard} { + if cmd.View == v { + foundView = true + break + } + } + if foundView == false { return pilosa.ErrInvalidView }