From 30474994ae5c00cfdc229cb1cc17673cab9f8623 Mon Sep 17 00:00:00 2001 From: Victor Baranov Date: Tue, 23 Jul 2019 15:23:11 +0300 Subject: [PATCH] Fix router page not found path --- CHANGELOG.md | 1 + .../block_scout_web/controllers/address_logs_controller.ex | 2 ++ .../controllers/address_transaction_controller.ex | 4 ++++ .../lib/block_scout_web/controllers/chain_controller.ex | 2 ++ .../block_scout_web/controllers/smart_contract_controller.ex | 2 ++ apps/block_scout_web/lib/block_scout_web/router.ex | 2 +- 6 files changed, 12 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b333ba4ef9..85f1241c2a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ - [#2324](https://github.com/poanetwork/blockscout/pull/2324) - set timeout for loading message on the main page ### Fixes +- [#2416](https://github.com/poanetwork/blockscout/pull/2416) - Fix "page not found" handling in the router - [#2410](https://github.com/poanetwork/blockscout/pull/2410) - preload smart contract for logs decoding - [#2398](https://github.com/poanetwork/blockscout/pull/2398) - show only one decoded candidate - [#2395](https://github.com/poanetwork/blockscout/pull/2395) - new block loading animation diff --git a/apps/block_scout_web/lib/block_scout_web/controllers/address_logs_controller.ex b/apps/block_scout_web/lib/block_scout_web/controllers/address_logs_controller.ex index e349ecd9ef..04c37badb5 100644 --- a/apps/block_scout_web/lib/block_scout_web/controllers/address_logs_controller.ex +++ b/apps/block_scout_web/lib/block_scout_web/controllers/address_logs_controller.ex @@ -115,4 +115,6 @@ defmodule BlockScoutWeb.AddressLogsController do not_found(conn) end end + + def search_logs(conn, _), do: not_found(conn) end diff --git a/apps/block_scout_web/lib/block_scout_web/controllers/address_transaction_controller.ex b/apps/block_scout_web/lib/block_scout_web/controllers/address_transaction_controller.ex index f6d9b8a30f..ba29c766c1 100644 --- a/apps/block_scout_web/lib/block_scout_web/controllers/address_transaction_controller.ex +++ b/apps/block_scout_web/lib/block_scout_web/controllers/address_transaction_controller.ex @@ -130,6 +130,8 @@ defmodule BlockScoutWeb.AddressTransactionController do end end + def token_transfers_csv(conn, _), do: not_found(conn) + def transactions_csv(conn, %{"address_id" => address_hash_string}) do with {:ok, address_hash} <- Chain.string_to_address_hash(address_hash_string), {:ok, address} <- Chain.hash_to_address(address_hash) do @@ -149,4 +151,6 @@ defmodule BlockScoutWeb.AddressTransactionController do not_found(conn) end end + + def transactions_csv(conn, _), do: not_found(conn) end 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 40a0fd3bbb..520fe8ea29 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 @@ -52,6 +52,8 @@ defmodule BlockScoutWeb.ChainController do end end + def search(conn, _), do: not_found(conn) + def token_autocomplete(conn, %{"q" => term}) when is_binary(term) do if term == "" do json(conn, "{}") diff --git a/apps/block_scout_web/lib/block_scout_web/controllers/smart_contract_controller.ex b/apps/block_scout_web/lib/block_scout_web/controllers/smart_contract_controller.ex index 70ec6219f3..58fb4c4432 100644 --- a/apps/block_scout_web/lib/block_scout_web/controllers/smart_contract_controller.ex +++ b/apps/block_scout_web/lib/block_scout_web/controllers/smart_contract_controller.ex @@ -30,6 +30,8 @@ defmodule BlockScoutWeb.SmartContractController do end end + def index(conn, _), do: not_found(conn) + def show(conn, params) do with true <- ajax?(conn), {:ok, address_hash} <- Chain.string_to_address_hash(params["id"]), diff --git a/apps/block_scout_web/lib/block_scout_web/router.ex b/apps/block_scout_web/lib/block_scout_web/router.ex index 4f5a8e1bed..7a1f5b3ed9 100644 --- a/apps/block_scout_web/lib/block_scout_web/router.ex +++ b/apps/block_scout_web/lib/block_scout_web/router.ex @@ -261,6 +261,6 @@ defmodule BlockScoutWeb.Router do get("/api_docs", APIDocsController, :index) get("/eth_rpc_api_docs", APIDocsController, :eth_rpc) - get("/:page", PageNotFoundController, :index) + get("/*path", PageNotFoundController, :index) end end