From c3f107d52984fa00e48bcbcb4514c141676efb09 Mon Sep 17 00:00:00 2001 From: Holger Just Date: Wed, 20 Dec 2023 17:51:08 +0100 Subject: [PATCH] Explicitly render a 404 on non-JS requests to watchers#new This avoids logged exceptions / warnings and renders a "nice" error page instead of a empty HTTP 406 response with no body. --- app/controllers/watchers_controller.rb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/app/controllers/watchers_controller.rb b/app/controllers/watchers_controller.rb index 58c875b0c5..dbacb5c766 100644 --- a/app/controllers/watchers_controller.rb +++ b/app/controllers/watchers_controller.rb @@ -32,7 +32,12 @@ def unwatch accept_api_auth :create, :destroy def new - @users = users_for_new_watcher + respond_to do |format| + format.html { render_404 } + format.js do + @users = users_for_new_watcher + end + end end def create -- 2.39.2