Merge pull request #4355 from blockscout/vb-search-empty-string

Do not redirect to 404 page with empty string in the search field
pull/4371/head
Victor Baranov 3 years ago committed by GitHub
commit 3286e16205
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 1
      CHANGELOG.md
  2. 4
      apps/block_scout_web/lib/block_scout_web/controllers/chain_controller.ex

@ -5,6 +5,7 @@
### Fixes ### Fixes
### Chore ### Chore
- [#4355](https://github.com/blockscout/blockscout/pull/4355) - Do not redirect to 404 page with empty string in the search field
## 3.7.1-beta ## 3.7.1-beta

@ -78,6 +78,10 @@ defmodule BlockScoutWeb.ChainController do
%{earliest: x_days_back, latest: latest} %{earliest: x_days_back, latest: latest}
end end
def search(conn, %{"q" => ""}) do
show(conn, [])
end
def search(conn, %{"q" => query}) do def search(conn, %{"q" => query}) do
query query
|> String.trim() |> String.trim()

Loading…
Cancel
Save