[Bps-public-commit] RT-Extension-CommandByMail branch greedier-whitespace-matching created. 3.01-1-g2485154

BPS Git Server git at git.bestpractical.com
Wed Jul 12 13:22:57 UTC 2023


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "RT-Extension-CommandByMail".

The branch, greedier-whitespace-matching has been created
        at  2485154ff3a78fd933b7ea34a36b0ff4557c91fb (commit)

- Log -----------------------------------------------------------------
commit 2485154ff3a78fd933b7ea34a36b0ff4557c91fb
Author: Brian Conry <bconry at bestpractical.com>
Date:   Mon Jul 10 12:58:51 2023 -0500

    Make pseudoheader whitespace matches non-greedy
    
    The regex for matching pseudoheaders in the message body had three
    places where it specified '\s*?', a non-greedy 0-or-more match on
    whitespace.
    
    In two of these cases, the one before the colon ':' and the one near the
    end of the regex, due to the context around the whitespace a non-greedy
    match MUST match the exact same substring as a greedy match would,
    making them unnecessary and possibly causing additional backtracking.
    
    In the third case, the one between the colon ':' and the second capture
    group '(.*)', the non-greedy qualifier means that it will relinquish all
    whitespace to be included in the second capture group.  This defeats the
    purpose of having the '\s' at that position in the expression.

diff --git a/lib/RT/Extension/CommandByMail.pm b/lib/RT/Extension/CommandByMail.pm
index 88111f5..ff46bb7 100644
--- a/lib/RT/Extension/CommandByMail.pm
+++ b/lib/RT/Extension/CommandByMail.pm
@@ -367,7 +367,7 @@ sub ProcessCommands {
     my $found_pseudoheaders = 0;
     foreach my $line (@content) {
         next if $line =~ /^\s*$/ && ! $found_pseudoheaders;
-        last if $line !~ /^(?:(\S+(?:{.*})?)\s*?:\s*?(.*)\s*?|)$/;
+        last if $line !~ /^(?:(\S+(?:{.*})?)\s*:\s*(.*)\s*|)$/;
         last if not defined $1 and $found_pseudoheaders;
         next if not defined $1;
 

-----------------------------------------------------------------------


hooks/post-receive
-- 
RT-Extension-CommandByMail


More information about the Bps-public-commit mailing list