diff options
| author | Michael Vogt <mvo@ubuntu.com> | 2018-01-02 10:02:16 +0100 |
|---|---|---|
| committer | Michael Vogt <mvo@ubuntu.com> | 2018-01-02 10:02:16 +0100 |
| commit | 3c2ed7394d85e8a05a1ee65da7a1af416a3d2735 (patch) | |
| tree | 09bda2711f842f4177d65a47443ea414e63249a1 | |
| parent | 7855e9512388fb8beab2af14b8465758ba119517 (diff) | |
snap: fix snap find " " outputlp-1740605
| -rw-r--r-- | cmd/snap/cmd_find.go | 7 | ||||
| -rw-r--r-- | tests/main/searching/task.yaml | 6 |
2 files changed, 12 insertions, 1 deletions
diff --git a/cmd/snap/cmd_find.go b/cmd/snap/cmd_find.go index bf68c4284b..03d5df556f 100644 --- a/cmd/snap/cmd_find.go +++ b/cmd/snap/cmd_find.go @@ -1,7 +1,7 @@ // -*- Mode: Go; indent-tabs-mode: t -*- /* - * Copyright (C) 2016 Canonical Ltd + * Copyright (C) 2016-2018 Canonical Ltd * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License version 3 as @@ -112,6 +112,11 @@ func (x *cmdFind) Execute(args []string) error { return ErrExtraArgs } + // LP: 1740605 + if strings.TrimSpace(x.Positional.Query) == "" { + x.Positional.Query = "" + } + // magic! `snap find` returns the featured snaps if x.Positional.Query == "" && x.Section == "" { x.Section = "featured" diff --git a/tests/main/searching/task.yaml b/tests/main/searching/task.yaml index d4ec6ed0dc..faac1466eb 100644 --- a/tests/main/searching/task.yaml +++ b/tests/main/searching/task.yaml @@ -46,3 +46,9 @@ execute: | else snap find --section=database cassandra 2>&1 | MATCH '0 snaps' fi + + # LP: 1740605 + if snap find " " | grep "status code 403"; then + echo 'snap find " " returns non user friendly error with whitespace query' + exit 1 + fi \ No newline at end of file |
