attachment filename unreadable

Giganews Newsgroups
Subject: attachment filename unreadable
Posted by:  Alan Dodd (alan.do…@tele2.it)
Date: Thu, 23 Nov 2006

Hi all!

When I send a message with thunderbird with an attachment which has a
filename of max 50 chars (+ extension)
(example:'this is just a test with 50 characters in filename.pdf')
in my prog I see the filename as
'this_is_just_a_test_with_50_characters_in_filename.pdf'

OK!

If the attachment filename is longer, in my prog the filename is empty
(but the body of the attachment is there, and I can save it to a file
if I give it a file name)

Not OK!

************************************************************************
stripped source of 'good' message with filename of 50 chars as seen by
thunderbird:
************************************************************************

........
.........
Content-Type: multipart/mixed;
boundary="------------050103060905090009050209"

This is a multi-part message in MIME format.
--------------050103060905090009050209
Content-Type: text/plain; charset=ISO-8859-15; format=flowed
Content-Transfer-Encoding: 7bit

--------------050103060905090009050209
Content-Type: application/pdf;
name="this is just a test with 50 characters in filename.pdf"
Content-Transfer-Encoding: base64
Content-Disposition: inline;
filename*0="this is just a test with 50 characters in filename.pdf"

JVBERi0xLjMKJcfsj6IKNSAwIG9iago8PC9MZW5ndGggNiAwIFIvRmlsdGVyIC9GbGF0ZURl
Y29kZT4+CnN0cmVhbQp4nK1TTY/UMAwVMANDfoWP7WGzsZ3YyRUJIe2Jhd6AA1rNLjtikJYP
...............
..........

************************************************************************
stripped source of 'bad' message with filename of 51 chars as seen by
thunderbird:
************************************************************************

.........
..........
Content-Type: multipart/mixed;
boundary="------------050409080301060201060505"

This is a multi-part message in MIME format.
--------------050409080301060201060505
Content-Type: text/plain; charset=ISO-8859-15; format=flowed
Content-Transfer-Encoding: 7bit

--------------050409080301060201060505
Content-Type: application/pdf;
name*0="this is just a test with 51  characters in filename.pdf"
Content-Transfer-Encoding: base64
Content-Disposition: inline;
filename*0="this is just a test with 51  characters in filename.pdf"

JVBERi0xLjMKJcfsj6IKNSAwIG9iago8PC9MZW5ndGggNiAwIFIvRmlsdGVyIC9GbGF0ZURl
Y29kZT4+CnN0cmVhbQp4nK1TTY/UMAwVMANDfoWP7WGzsZ3YyRUJIe2Jhd6AA1rNLjtikJYP
...........
...........

***************************************************
part of my code
****************************************************

for intInd := 0 to Pred(Mess.MessageParts.Count) do
  begin
//if attachment found
    if (Mess.MessageParts.Items[intInd] is TIdAttachmentFile) then
      begin

attfilename:=TIdAttachmentFile(Mess.MessageParts.Items[intInd]).FileName
;
//attfilename is empty if filename longer the 50

blobst:=DM.inboxattachQR.CreateBlobStream(DM.inboxattachQR.FieldByName('
attach') as TBlobField,bmread);

TIdattachmentFile(Mess.MessageParts.Items[intInd]).SaveToStream(blobst);
      blobst.Free;
//I use blobst, which is a Tstream, because I save the attachment in a
blob field of a database table
      DM.inboxattachQR.Post;
      end;
  end;

--

notice that in the source of the 'bad' message we have  name*0="this...
instead of name="this...

so I think it is Indy (10) that cannot cope with this format
am I right?
thanks in advance for an answer

Alan

Replies