Skip to content
Snippets Groups Projects
Commit 414fcb1f authored by Ryan Senior's avatar Ryan Senior
Browse files

Fix NullPointerException when not including a search string

This is an issue resulting from the merge with the
collections-project-bulk-actions branch. A missing search string was
allowed in the form validation, but would fail as it tried to
lower-case the nil string.
parent e918bfcd
No related branches found
No related tags found
No related merge requests found
......@@ -196,7 +196,7 @@
(s/defn ^:private make-search-context :- SearchContext
[search-string :- (s/maybe su/NonBlankString)
archived-string :- (s/maybe su/BooleanString)]
{:search-string (str "%" (str/lower-case search-string) "%")
{:search-string search-string
:archived? (Boolean/parseBoolean archived-string)
:visible-collections (coll/permissions-set->visible-collection-ids @*current-user-permissions-set*)})
......
(ns metabase.api.search-test
(:require [clojure.string :as str]
(:require [clojure.set :as set]
[clojure.string :as str]
[expectations :refer :all]
[metabase.models
[card :refer [Card]]
......@@ -85,6 +86,14 @@
(with-search-items-in-root-collection "test"
(search-request :crowberto :q "test")))
;; Search with no search string. Note this search everything in the DB, including any stale data left behind from
;; previous tests. Instead of an = comparison here, just ensure our default results are included
(expect
(set/subset?
default-search-results
(with-search-items-in-root-collection "test"
(search-request :crowberto))))
;; Ensure that users without perms for the root collection don't get results
;; NOTE: Metrics and segments don't have collections, so they'll be returned
(expect
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment