This is an automated email from the ASF dual-hosted git repository.

sebb pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/whimsy.git


The following commit(s) were added to refs/heads/master by this push:
     new 79a79ca4 Better error message if not found
79a79ca4 is described below

commit 79a79ca40e8b3e5fb93d5e7895d7da12d41a2bf4
Author: Sebb <[email protected]>
AuthorDate: Thu Oct 3 12:10:19 2024 +0100

    Better error message if not found
---
 www/secretary/workbench/server.rb | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/www/secretary/workbench/server.rb 
b/www/secretary/workbench/server.rb
index b10e32f8..f97c26c4 100644
--- a/www/secretary/workbench/server.rb
+++ b/www/secretary/workbench/server.rb
@@ -250,7 +250,7 @@ end
 # list of parts for a single message
 get %r{/(\d{6})/(\w+)/_index_} do |month, hash|
   message = Mailbox.new(month).find(hash)
-  pass unless message
+  return [404, 'Message Not Found'] unless message
   @attachments = message.attachments
   @headers = message.headers.dup
   @headers.delete :attachments
@@ -270,9 +270,9 @@ end
 # message body for a single message
 get %r{/(\d{6})/(\w+)/_body_} do |month, hash|
   @message = Mailbox.new(month).find(hash)
+  return [404, 'Message Not Found'] unless @message
   @cssmtime = File.mtime('public/secmail.css').to_i
   @appmtime = Wunderbar::Asset.convert(File.join(settings.views, 
'app.js.rb')).mtime.to_i
-  pass unless @message
   _html :body
 end
 

Reply via email to