You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@whimsical.apache.org by se...@apache.org on 2019/02/12 09:04:35 UTC

[whimsy] branch master updated: Also match tab start; don't fail if no match

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 b04dee4  Also match tab start; don't fail if no match
b04dee4 is described below

commit b04dee4e7b443eb62e41dde621eac85837e553c7
Author: Sebb <se...@apache.org>
AuthorDate: Tue Feb 12 09:04:33 2019 +0000

    Also match tab start; don't fail if no match
---
 tools/deliver.rb                          | 4 +++-
 www/secretary/workbench/models/message.rb | 4 +++-
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/tools/deliver.rb b/tools/deliver.rb
index 5cb11c3..77ae275 100644
--- a/tools/deliver.rb
+++ b/tools/deliver.rb
@@ -12,7 +12,9 @@ def self.getmid(hdrs)
   mid = hdrs[/^Message-ID:.*/i]
   if mid =~ /^Message-ID:\s*$/i # no mid on the first line
     # capture the next line and join them together
-    mid = hdrs[/^Message-ID:.*\r?\n .*/i].sub(/\r?\n/,'')
+    # line may also start with tab; we don't use \s as this also matches EOL
+    # Rescue is in case we don't match properly - we want to return nil in that case
+    mid = hdrs[/^Message-ID:.*\r?\n[ \t].*/i].sub(/\r?\n/,'') rescue nil
   end
   mid
 end
diff --git a/www/secretary/workbench/models/message.rb b/www/secretary/workbench/models/message.rb
index 09dd0ad..34682ae 100644
--- a/www/secretary/workbench/models/message.rb
+++ b/www/secretary/workbench/models/message.rb
@@ -315,7 +315,9 @@ class Message
     mid = hdrs[/^Message-ID:.*/i]
     if mid =~ /^Message-ID:\s*$/i # no mid on the first line
       # capture the next line and join them together
-      mid = hdrs[/^Message-ID:.*\r?\n .*/i].sub(/\r?\n/,'')
+      # line may also start with tab; we don't use \s as this also matches EOL
+      # Rescue is in case we don't match properly - we want to return nil in that case
+      mid = hdrs[/^Message-ID:.*\r?\n[ \t].*/i].sub(/\r?\n/,'') rescue nil
     end
     mid
   end