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...@bugzilla.spamassassin.org on 2005/05/13 17:32:18 UTC

[Bug 4328] New: Filename Not Found when Parsing Message

http://bugzilla.spamassassin.org/show_bug.cgi?id=4328

           Summary: Filename Not Found when Parsing Message
           Product: Spamassassin
           Version: SVN Trunk (Latest Devel Version)
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P5
         Component: spamassassin
        AssignedTo: dev@spamassassin.apache.org
        ReportedBy: bret.miller@wcg.org


I'm trying to use Mail::SpamAssassin::Message->find_parts to look at the names
of any attachments. In the process, I discovered a bug in the way Message.pm
parses the file name.

Currently using SpamAssassin 3.1.0-r169253 (2005-05-09)

In the sub _parse_normal, line 744 reads:
my($filename) = $disp =~ /name="?([^\";]+)"?/i || $part_msg->{'type'} =~
/name="?([^\";]+)"?/i;

It should read:
my($filename) = $disp =~ /name="?([^\";]+)"?/i ||
$part_msg->header('content-type') =~ /name="?([^\";]+)"?/i;

The code above it uses Mail::SpamAssassin::Util::parse_content_type to parse the
content type into $part_msg->{'type'}, removing the name= tag from it. In order
to get the file name, you then must use the original content-type header.



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

[Bug 4328] Filename Not Found when Parsing Message

Posted by bu...@bugzilla.spamassassin.org.
http://bugzilla.spamassassin.org/show_bug.cgi?id=4328


felicity@kluge.net changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|normal                      |minor
   Target Milestone|Undefined                   |3.1.0




------- Additional Comments From felicity@kluge.net  2005-05-13 08:52 -------
Hrm.  Suboptimal.

I'll put in a patch shortly, different from the one mentioned.  (parse_content_type already gets the 
filename, so we don't actually need to parse for it again...)



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

[Bug 4328] [review] Filename Not Found when Parsing Message

Posted by bu...@bugzilla.spamassassin.org.
http://bugzilla.spamassassin.org/show_bug.cgi?id=4328





------- Additional Comments From dylmac@gmail.com  2005-05-31 15:23 -------
With this sample code, I get the name as '1':

my $disp = "attachment;filename=cd.exe";
my($filename) = $disp =~ /name="?([^\";]+)"?/i || "ct.exe";
warn $filename;




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

[Bug 4328] Filename Not Found when Parsing Message

Posted by bu...@bugzilla.spamassassin.org.
http://bugzilla.spamassassin.org/show_bug.cgi?id=4328


felicity@kluge.net changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
         Resolution|FIXED                       |
   Target Milestone|3.1.0                       |3.0.4




------- Additional Comments From felicity@kluge.net  2005-05-13 09:13 -------
actually, I'm going to reopen this and aim at 3.0.4...  in case there actually is one at some point.



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

[Bug 4328] [review] Filename Not Found when Parsing Message

Posted by bu...@bugzilla.spamassassin.org.
http://bugzilla.spamassassin.org/show_bug.cgi?id=4328





------- Additional Comments From sidney@sidney.com  2005-06-05 15:32 -------
+1




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

[Bug 4328] Filename Not Found when Parsing Message

Posted by bu...@bugzilla.spamassassin.org.
http://bugzilla.spamassassin.org/show_bug.cgi?id=4328





------- Additional Comments From felicity@kluge.net  2005-05-13 09:17 -------
Created an attachment (id=2870)
 --> (http://bugzilla.spamassassin.org/attachment.cgi?id=2870&action=view)
suggested patch

here's what went into 3.1, applies against current 3.0.4-svn



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

[Bug 4328] [review] Filename Not Found when Parsing Message

Posted by bu...@bugzilla.spamassassin.org.
http://bugzilla.spamassassin.org/show_bug.cgi?id=4328





------- Additional Comments From spamassassin@dostech.ca  2005-05-31 16:09 -------
+1 works for me too.  I had mistakenly thought the last patch wanted a '1' if it
was a filename.



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

[Bug 4328] [review] Filename Not Found when Parsing Message

Posted by bu...@bugzilla.spamassassin.org.
http://bugzilla.spamassassin.org/show_bug.cgi?id=4328


felicity@kluge.net changed:

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




------- Additional Comments From felicity@kluge.net  2005-05-31 15:35 -------
Well, that's suboptimal.  The sad part is that I tested the patch before putting it up.  It worked then... 
Really.

Let's try this again. <sigh>

(In reply to comment #9)
> With this sample code, I get the name as '1':
> 
> my $disp = "attachment;filename=cd.exe";
> my($filename) = $disp =~ /name="?([^\";]+)"?/i || "ct.exe";
> warn $filename;
> 





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

[Bug 4328] [review] Filename Not Found when Parsing Message

Posted by bu...@bugzilla.spamassassin.org.
http://bugzilla.spamassassin.org/show_bug.cgi?id=4328


felicity@kluge.net changed:

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




------- Additional Comments From felicity@kluge.net  2005-05-19 21:48 -------
committed, r171048.



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

[Bug 4328] [review] Filename Not Found when Parsing Message

Posted by bu...@bugzilla.spamassassin.org.
http://bugzilla.spamassassin.org/show_bug.cgi?id=4328


felicity@kluge.net changed:

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




------- Additional Comments From felicity@kluge.net  2005-05-31 15:40 -------
Created an attachment (id=2912)
 --> (http://bugzilla.spamassassin.org/attachment.cgi?id=2912&action=view)
new suggested patch

applies against 3.0, is very explicit about where it's getting data from. 
tested, again, and works for both situations.  <grumble>



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

[Bug 4328] [review] Filename Not Found when Parsing Message

Posted by bu...@bugzilla.spamassassin.org.
http://bugzilla.spamassassin.org/show_bug.cgi?id=4328


felicity@kluge.net changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|Filename Not Found when     |[review] Filename Not Found
                   |Parsing Message             |when Parsing Message




------- Additional Comments From felicity@kluge.net  2005-05-17 22:11 -------
there's a patch, so putting into review state for 3.0.4



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

[Bug 4328] Filename Not Found when Parsing Message

Posted by bu...@bugzilla.spamassassin.org.
http://bugzilla.spamassassin.org/show_bug.cgi?id=4328


felicity@kluge.net changed:

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




------- Additional Comments From felicity@kluge.net  2005-05-13 09:12 -------
Ok, fix committed.  r170049

Thanks. :)



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

[Bug 4328] [review] Filename Not Found when Parsing Message

Posted by bu...@bugzilla.spamassassin.org.
http://bugzilla.spamassassin.org/show_bug.cgi?id=4328





------- Additional Comments From spamassassin@dostech.ca  2005-05-19 21:38 -------
+1



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

[Bug 4328] [review] Filename Not Found when Parsing Message

Posted by bu...@bugzilla.spamassassin.org.
http://bugzilla.spamassassin.org/show_bug.cgi?id=4328


spamassassin@dostech.ca changed:

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




------- Additional Comments From spamassassin@dostech.ca  2005-06-05 16:11 -------
Committed revision 180169.



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

[Bug 4328] [review] Filename Not Found when Parsing Message

Posted by bu...@bugzilla.spamassassin.org.
http://bugzilla.spamassassin.org/show_bug.cgi?id=4328





------- Additional Comments From jm@jmason.org  2005-05-19 16:22 -------
+1



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