Hello Sam,
When user use Display attachment link in message view, and if browser don't
know how to display it, Save As/Download window appear, but default name is
meaningless number (it's probably cookie timestamp, but it doesn't matter). I
know that user should use Download link to download attachment, but this bug is
also available when user first display attachments (image for example), and
then choose "File -> Save Page as" from browser menu or "Save Image as ..."
from context menu and this is very common situation, so I made patch that set
Content-Disposition: in HTTP headers, and now browser can set correct
attachment name.
best regards,
Marcin Semeniuk
diff -u -r courier-0.53.2.20060607/webmail/folder.c
courier-0.53.2.20060607-work/webmail/folder.c
--- courier-0.53.2.20060607/webmail/folder.c 2006-05-29 15:31:15.000000000 +0200
+++ courier-0.53.2.20060607-work/webmail/folder.c 2006-06-30 12:21:52.000000000
+0200
@@ -4437,9 +4437,10 @@
static int download_func(const char *, size_t, void *);
-void disposition_attachment(FILE *fp, const char *p)
+void disposition_attachment(FILE *fp, const char *p, int attachment)
{
- fprintf(fp, "Content-Disposition: attachment; filename=\"");
+ fprintf(fp, "Content-Disposition: %sfilename=\"",
+ attachment ? "attachment; ":"");
while (*p)
{
if (*p == '"' || *p == '\\')
@@ -4518,11 +4519,14 @@
if (!p || !*p) p=content_name;
if (!p || !*p) p="message.msg";
- disposition_attachment(stdout, p);
+ disposition_attachment(stdout, p, 1);
content_type="application/octet-stream";
free(disposition_filename);
+ } else {
+ if (content_name && *content_name)
+ disposition_attachment(stdout, content_name, 0);
}
-
+
printf(
content_name && *content_name ?
"Content-Type: %s; charset=%s; name=\"%s\"\n\n":