[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [bug-mailutils] Re: How get_attachment_name from multiline Content-D

From: Sergey Poznyakoff
Subject: Re: [bug-mailutils] Re: How get_attachment_name from multiline Content-Disposition?
Date: Wed, 07 Apr 2010 17:45:49 +0300

Kostik <address@hidden> ha escrit:

> I did it. Now I use the mailutils from git.


> 1. Yes, "filename with newline" works well. Thanx.


> 2. get_attachment_name for message with filename*0*, filename*1* , ...
> works.


> But does not work, if filename*0*, filename*1*, filename*3*
> (filename*2* is missing).

That's intended.  It really should not.  Quoth RFC 2231, section 3:

   And this obvious solution [to the problem of parameter value
   continuations] is exactly what is specified here: The asterisk
   character ("*") followed by a decimal count is employed to
   indicate that multiple parameters are being used to encapsulate
   a single parameter value.  The count starts at 0 and increments
   by 1 for each subsequent section of the parameter value.  Decimal
   values are used and neither leading zeroes nor _gaps_[1] in the
   sequence are allowed.

[1]. Underlying is mine.

> Any way, do I correctly understand: after that I must do
> mu_url_decode(fname) for decode such filenames. Yes?

Nope.  I've forgotten to inform you (or, better said, supposed
you to have paid attention to the ChangeLog, alias git log.  It's a rule
of thumb now, that you've cloned the repo): use
mu_message_aget_decoded_attachment_name, which does all the dirty 
work for you.  E.g.:

  char *name; /* Attachment name */
  size_t n;   /* Attachment number */
  char *encoding = 'UTF-8'; /* For decoding the att. name. The actual
                               value is up to you, of course. Perhaps
                               KOI8-R, or whatever ...*/
  mu_message_get_part (msg, n, &pmsg);
  mu_message_aget_decoded_attachment_name (pmsg, encoding, &name, NULL);
  /* ... some code using `name' goes here ... , and then: */
  free (name); /* don't forget to free it: it is malloc'ed */

> 3. Does not work: attachment_name=(null) for Content-Disposition like
> this:

I'll check this later.  Keep an ear out for updates.

> Does not work but really existing attachements:
> -- Content-Disposition: attachment; filename = "111.doc"
> -- Content-Disposition: attachment; name = "111.doc"
> -- Content-Disposition: attachment; name="111.doc"

Hmm, give more details please, would you?


reply via email to

[Prev in Thread] Current Thread [Next in Thread]