Skip to content

Commit 0fcd87a

Browse files
fix: 🐛 search endpoint was searching externally even when search query is empty
1 parent 054bd3c commit 0fcd87a

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

src/api/handler.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,10 @@ func (h *Handler) SmartSearch(w http.ResponseWriter, r *http.Request) {
5252
ctx, cancel := context.WithTimeout(r.Context(), 12*time.Second)
5353
defer cancel()
5454

55+
log.Printf("Search query: %s", query)
56+
if query == "\"\"" || query == "" {
57+
h.rp.ServeHTTP(w, r)
58+
}
5559
body, contentType, err := h.searchService.SmartSearch(ctx, query, r.URL.Path, r.URL.RawQuery)
5660
if err != nil {
5761
http.Error(w, "Internal Server Error", http.StatusInternalServerError)

0 commit comments

Comments
 (0)