diff --git a/core/src/main/java/hudson/search/Search.java b/core/src/main/java/hudson/search/Search.java index 853c8ea85177..a3c76a7fc9d5 100644 --- a/core/src/main/java/hudson/search/Search.java +++ b/core/src/main/java/hudson/search/Search.java @@ -160,19 +160,14 @@ public void doSuggestOpenSearch(StaplerRequest2 req, StaplerResponse2 rsp, @Quer public void doSuggest(StaplerRequest2 req, StaplerResponse2 rsp, @QueryParameter String query) throws IOException, ServletException { Result r = new Result(); for (SuggestedItem item : getSuggestions(req, query)) { - String icon = item.item.getSearchIcon(); - String iconXml = null; - - if (icon == null) { - iconXml = Symbol.get(new SymbolRequest.Builder().withRaw("symbol-search").build()); - } else if (icon.startsWith("symbol-")) { - icon = null; - iconXml = Symbol.get(new SymbolRequest.Builder().withRaw(icon).build()); - } else { - icon = item.item.getSearchIcon(); + String symbolName = item.item.getSearchIcon(); + + if (symbolName == null || !symbolName.startsWith("symbol-")) { + symbolName = "symbol-search"; } - r.suggestions.add(new Item(item.getPath(), item.getUrl(), icon, iconXml)); + r.suggestions.add(new Item(item.getPath(), item.getUrl(), "", + Symbol.get(new SymbolRequest.Builder().withRaw(symbolName).build()))); } rsp.serveExposedBean(req, r, Flavor.JSON); }