From 73ae37add1187aafbb215b446e817d2e7dc036e7 Mon Sep 17 00:00:00 2001 From: Daniel Nitsikopoulos Date: Mon, 13 Feb 2023 10:37:49 +1100 Subject: [PATCH] Correctly respond with 404 --- app/action.rb | 1 + app/actions/pages/show.rb | 1 + 2 files changed, 2 insertions(+) diff --git a/app/action.rb b/app/action.rb index bba2581..860ddda 100644 --- a/app/action.rb +++ b/app/action.rb @@ -40,6 +40,7 @@ module Adamantium end def not_found(_req, res, _exception) + res.status = 404 res.render not_found_view end diff --git a/app/actions/pages/show.rb b/app/actions/pages/show.rb index 77e73fe..20fc8f9 100644 --- a/app/actions/pages/show.rb +++ b/app/actions/pages/show.rb @@ -7,6 +7,7 @@ module Adamantium def handle(req, res) slug = req.params[:slug] + res.status = File.exist?("app/content/pages/#{slug}.md") ? 200 : 404 res.render show, slug: slug end end