# This patch allows to specify files with spaces with the attach: header.
# see http://dev.mutt.org/trac/ticket/3179
--- headers.c.orig	2009-02-04 16:07:51.000000000 +0100
+++ headers.c	2009-02-04 16:04:50.000000000 +0100
@@ -152,22 +152,44 @@
       BODY *body;
       BODY *parts;
       char *q;
+      int bs=0;
+      int leng=0;
 
       p = cur->data + 7;
       SKIPWS (p);
       if (*p)
-      {
-	if ((q = strpbrk (p, " \t")))
-	{
-	  mutt_substrcpy (path, p, q, sizeof (path));
-	  SKIPWS (q);
+      { 
+	q=p;
+	while (*p) {
+	  if (*p == '\\'){
+	    bs=1;
+	  }
+	  if (isspace(*p)){
+	    if (bs){
+	      q--;
+	      *q = *p;
+	      p++; 
+	      q++;
+	      bs = 0;
+	      continue;
+	    }
+	    else
+	      break;
+	  }
+	  *q = *p;
+	  q++;
+	  p++;
+	  leng++;
 	}
-	else
-	  strfcpy (path, p, sizeof (path));
+	*q='\0'
+	q-=leng;
+	strfcpy (path, q, leng+1); 
+	SKIPWS (p);
+
 	mutt_expand_path (path, sizeof (path));
 	if ((body = mutt_make_file_attach (path)))
 	{
-	  body->description = safe_strdup (q);
+	  body->description = safe_strdup (p);
 	  for (parts = msg->content; parts->next; parts = parts->next) ;
 	  parts->next = body;
 	}
