diff --git a/CHANGELOG.md b/CHANGELOG.md index 96cb86568a..78f634f0c8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ ### Fixes ### 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 diff --git a/apps/block_scout_web/lib/block_scout_web/controllers/chain_controller.ex b/apps/block_scout_web/lib/block_scout_web/controllers/chain_controller.ex index 338c9096e0..ea17c13bcc 100644 --- a/apps/block_scout_web/lib/block_scout_web/controllers/chain_controller.ex +++ b/apps/block_scout_web/lib/block_scout_web/controllers/chain_controller.ex @@ -78,6 +78,10 @@ defmodule BlockScoutWeb.ChainController do %{earliest: x_days_back, latest: latest} end + def search(conn, %{"q" => ""}) do + show(conn, []) + end + def search(conn, %{"q" => query}) do query |> String.trim()