Just a guess, but the =~ operator in Ruby returns either the index inside the 
string
where the match is found or nil, depending on the context. You might want to try

_warn "Invalid From address #{@from}" if @from !~ 
/\A("?[\s\w]+"?\s+<)?\w+@apache\.org>?\z/

but you should also note that \w excludes hyphen and ".", so 
[email protected] <mailto:[email protected]>
will not match regardless. You need [\w\+\=\.\-][email protected] 
<http://apache.org/> (or something), or just
check the end with /\@apache.org>?$/ 

....Roy


> On Feb 9, 2021, at 5:34 PM, Matt Sicker <[email protected]> wrote:
> 
> That looks like the same regex code, so I'm not sure what's going on.
> 
> On Tue, 9 Feb 2021 at 18:41, Craig Russell <[email protected]> wrote:
>> 
>> I think this is the change that made the error occur.
>> 
>> https://github.com/apache/whimsy/commit/32076c779bbc990f7e8ea0b002ac62903cd4fb1a#diff-7acc05691a456b71d17e29ce33d05a2cf43783be9d87eb7fac49458a46b47ab5
>>  
>> <https://github.com/apache/whimsy/commit/32076c779bbc990f7e8ea0b002ac62903cd4fb1a#diff-7acc05691a456b71d17e29ce33d05a2cf43783be9d87eb7fac49458a46b47ab5>
>> 
>> @from.untaint if @from =~ /\A("?[\s\w]+"?\s+<)?\w+@apache\.org>?\z/
>> 
>> was changed to
>> 
>> 
>> _warn "Invalid From address #{@from}" unless @from =~ 
>> /\A("?[\s\w]+"?\s+<)?\w+@apache\.org>?\z/
>> 
>> I looked at some of the other actions, e.g. ccla.json.rb grant.json.rb and 
>> they do not have a similar email check.
>> 
>> So, why is this necessary? And can the check pass my email address? "Craig L 
>> Russell <[email protected] <mailto:[email protected]>>"
>> 
>> Craig
>> 
>> 
>>> On Feb 8, 2021, at 3:51 PM, sebb <[email protected]> wrote:
>>> 
>>> A quick search in GitHub gives the following:
>>> 
>>> https://github.com/apache/whimsy/search?q=%22Invalid+From+address%22
>>> 
>>> https://github.com/apache/whimsy/blob/5d0e0d05156fb011bb679c95b9f76fe35b7ffab6/www/secretary/workbench/views/actions/icla.json.rb#L13
>>> 
>>> At a quick glance RE looks OK. And AFAIK, no-one else has reported the 
>>> issue.
>>> 
>>> To proceed further you would need the exact error message.
>>> 
>>> On Mon, 8 Feb 2021 at 22:21, Craig Russell <[email protected]> wrote:
>>>> 
>>>> Whenever I file a document, I get the
>>>> 
>>>> error message: Warning: Invalid From address
>>>> Continue anyway?
>>>> 
>>>> But there is nothing wrong with the address, and everything completes 
>>>> normally, and at the end, another warning with a red (return to mail index)
>>>> 
>>>> The headers look fine and the mail is processed normally. [1]
>>>> 
>>>> Any ideas?
>>>> 
>>>> Thanks,
>>>> Craig
>>>> 
>>>> [1] Date: Mon, 08 Feb 2021 22:12:26 +0000
>>>> From: Craig L Russell <[email protected]>
>>>> To: [email protected]
>>>> Cc: Daniel Gomm <[email protected]>,
>>>> [email protected],
>>>> [email protected]
>>>> Message-ID: <[email protected]>
>>>> Subject: [FORM] Account Request - [email protected]: Daniel Gomm
>>>> Mime-Version: 1.0
>>>> Content-Type: text/plain;
>>>> charset=UTF-8
>>>> Content-Transfer-Encoding: 7bit
>>>> 
>>>> 
>>>> 
>>>> Craig L Russell
>>>> [email protected]
>>>> 
>> 
>> Craig L Russell
>> [email protected]
>> 

Reply via email to