You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@spamassassin.apache.org by bu...@spamassassin.apache.org on 2024/07/11 21:03:05 UTC

[Bug 8268] New: trim whitespace from anchor text in uri_detail_list

https://bz.apache.org/SpamAssassin/show_bug.cgi?id=8268

            Bug ID: 8268
           Summary: trim whitespace from anchor text in uri_detail_list
           Product: Spamassassin
           Version: SVN Trunk (Latest Devel Version)
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: minor
          Priority: P2
         Component: Libraries
          Assignee: dev@spamassassin.apache.org
          Reporter: kent@mxguardian.net
  Target Milestone: Undefined

It would be convenient if leading & trailing whitespace was removed from
anchor_text in uri_detail_list. For example, HTML such as:

<a href="#">
   Download File
</a>

will end up with anchor_text containing "\n   Download File\n". This leads to
unexpected results if you have a rule such as:

uri-detail RULENAME text =~ /^download file$/i

The workaround is to not use regex anchors, or explicitly allow whitespace in
the regex:

uri-detail RULENAME text =~ /^\s*download file/i

However, I think this is non-intuitive and has tripped me up several times. I
don't think there is any harm in removing the whitespace since the rules of
HTML whitespace dictate that the HTML above should parse identically to this
HTML:

<a href="#">Download File</a>

Please see the attached patch and provide feedback.

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 8268] trim whitespace from anchor text in uri_detail_list

Posted by bu...@spamassassin.apache.org.
https://bz.apache.org/SpamAssassin/show_bug.cgi?id=8268

Kent Oyer <ke...@mxguardian.net> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED

--- Comment #4 from Kent Oyer <ke...@mxguardian.net> ---
committed as r1921124

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 8268] trim whitespace from anchor text in uri_detail_list

Posted by bu...@spamassassin.apache.org.
https://bz.apache.org/SpamAssassin/show_bug.cgi?id=8268

Kent Oyer <ke...@mxguardian.net> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Attachment #5959|0                           |1
        is obsolete|                            |

--- Comment #3 from Kent Oyer <ke...@mxguardian.net> ---
Created attachment 5969
  --> https://bz.apache.org/SpamAssassin/attachment.cgi?id=5969&action=edit
revised patch

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 8268] trim whitespace from anchor text in uri_detail_list

Posted by bu...@spamassassin.apache.org.
https://bz.apache.org/SpamAssassin/show_bug.cgi?id=8268

Kent Oyer <ke...@mxguardian.net> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |kent@mxguardian.net

--- Comment #1 from Kent Oyer <ke...@mxguardian.net> ---
Created attachment 5959
  --> https://bz.apache.org/SpamAssassin/attachment.cgi?id=5959&action=edit
patch

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 8268] trim whitespace from anchor text in uri_detail_list

Posted by bu...@spamassassin.apache.org.
https://bz.apache.org/SpamAssassin/show_bug.cgi?id=8268

--- Comment #2 from Kent Oyer <ke...@mxguardian.net> ---
I think it might be good to collapse whitespace between words as well. Again,
following the rules of HTML whitespace in case someone does this:

<a href="#">
   Download 
   File
</a>

-- 
You are receiving this mail because:
You are the assignee for the bug.