]> granicus.if.org Git - mutt/commitdiff
Support spaces in Attach: pseudoheader. Closes #3179.
authorRocco Rutte <pdmef@gmx.net>
Sun, 15 Feb 2009 15:09:50 +0000 (16:09 +0100)
committerRocco Rutte <pdmef@gmx.net>
Sun, 15 Feb 2009 15:09:50 +0000 (16:09 +0100)
doc/manual.xml.head
headers.c

index 0c227c7c94dec41094dd3a71348ee1276409a5f2..78bc19a40b269c2d93c8b167582a97933542f885 100644 (file)
@@ -1126,7 +1126,8 @@ You can also attach files to your message by specifying
 <literal>Attach:</literal> <emphasis>filename</emphasis>  &lsqb; <emphasis>description</emphasis> &rsqb;
 
 where <emphasis>filename</emphasis> is the file to attach and <emphasis>description</emphasis> is an
-optional string to use as the description of the attached file.
+optional string to use as the description of the attached file. Spaces
+in filenames have to be escaped using backslash (<quote>&bsol;</quote>).
 </para>
 
 </sect3>
index 0aa79154de14adb10ae227e1fbdb8a663b5a5944..ea08571586c7c0bfc8dd328dfb55e4887940c6b6 100644 (file)
--- a/headers.c
+++ b/headers.c
@@ -148,18 +148,27 @@ void mutt_edit_headers (const char *editor,
       BODY *body;
       BODY *parts;
       char *q;
+      int l = 0;
 
       p = cur->data + 7;
       SKIPWS (p);
       if (*p)
       {
-       if ((q = strpbrk (p, " \t")))
+       for (q = p; *q && *q != ' ' && *q != '\t'; q++)
        {
-         mutt_substrcpy (path, p, q, sizeof (path));
-         SKIPWS (q);
+         if (*q == '\\')
+         {
+           if (!*(q+1))
+             break;
+           q++;
+         }
+         if (l < sizeof (path) - 1)
+           path[l++] = *q;
        }
-       else
-         strfcpy (path, p, sizeof (path));
+       *q++ = 0;
+       SKIPWS (q);
+       path[l] = 0;
+
        mutt_expand_path (path, sizeof (path));
        if ((body = mutt_make_file_attach (path)))
        {