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 
apache....@apache.org <mailto:apache....@apache.org>
will not match regardless. You need [\w\+\=\.\-]+@apache.org 
<http://apache.org/> (or something), or just
check the end with /\@apache.org>?$/ 

....Roy


> On Feb 9, 2021, at 5:34 PM, Matt Sicker <boa...@gmail.com> 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 <apache....@gmail.com> 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 <c...@apache.org <mailto:c...@apache.org>>"
>> 
>> Craig
>> 
>> 
>>> On Feb 8, 2021, at 3:51 PM, sebb <seb...@gmail.com> 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 <apache....@gmail.com> 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 <c...@apache.org>
>>>> To: r...@apache.org
>>>> Cc: Daniel Gomm <daniel.g...@outlook.de>,
>>>> priv...@incubator.apache.org,
>>>> priv...@streampipes.apache.org
>>>> Message-ID: <6021b74a11f28_2913fac9429...@whimsy-vm6.mail>
>>>> Subject: [FORM] Account Request - daniel.g...@outlook.de: Daniel Gomm
>>>> Mime-Version: 1.0
>>>> Content-Type: text/plain;
>>>> charset=UTF-8
>>>> Content-Transfer-Encoding: 7bit
>>>> 
>>>> 
>>>> 
>>>> Craig L Russell
>>>> c...@apache.org
>>>> 
>> 
>> Craig L Russell
>> c...@apache.org
>> 

Reply via email to