whimsical-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject [whimsy] branch master updated: WHIMSY-352: allow reparse of attachments
Date Wed, 17 Mar 2021 14:07:27 GMT
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 071c362  WHIMSY-352: allow reparse of attachments
071c362 is described below

commit 071c362e238c52243aee2a6ec38f2b54ad0251dc
Author: Sebb <sebb@apache.org>
AuthorDate: Wed Mar 17 14:07:19 2021 +0000

    WHIMSY-352: allow reparse of attachments
---
 www/secretary/workbench/server.rb           | 12 ++++++++++++
 www/secretary/workbench/views/parts.html.rb |  1 +
 2 files changed, 13 insertions(+)

diff --git a/www/secretary/workbench/server.rb b/www/secretary/workbench/server.rb
index e583f32..2856de9 100644
--- a/www/secretary/workbench/server.rb
+++ b/www/secretary/workbench/server.rb
@@ -217,6 +217,18 @@ get %r{/(\d{6})/(\w+)/_raw_} do |month, hash|
   [200, {'Content-Type' => 'text/plain'}, message.raw]
 end
 
+# reparse an existing message
+get %r{/(\d{6})/(\w+)/_reparse_} do |month, hash|
+  mailbox = Mailbox.new(month)
+  message = mailbox.find(hash)
+  pass unless message
+  email = message.raw
+  headers = Message.parse(email)
+  message = Message.new(mailbox, hash, headers, email)
+  message.write_headers
+  [200, {'Content-Type' => 'text/plain'}, 'Done, reselect to show contents']
+end
+
 # intercede for potentially dangerous message attachments
 get %r{/(\d{6})/(\w+)/_danger_/(.*?)} do |month, hash, name|
   message = Mailbox.new(month).find(hash)
diff --git a/www/secretary/workbench/views/parts.html.rb b/www/secretary/workbench/views/parts.html.rb
index fb0edc7..2d9ca12 100644
--- a/www/secretary/workbench/views/parts.html.rb
+++ b/www/secretary/workbench/views/parts.html.rb
@@ -16,6 +16,7 @@ _html do
     _li! {_a 'text', href: '_body_', target: 'content'}
     _li! {_a 'headers', href: '_headers_', target: 'content'}
     _li! {_a 'raw', href: '_raw_', target: 'content'}
+    _li! {_a 'reparse', href: '_reparse_', target: 'content'}
   end
 
   _div_.parts!


Mime
View raw message