Commit 67a9efa3 67a9efa3986dcafc1c76f0d04ce21a63956a1b48 by Sergey Poznyakoff

(store_handler): Honor the "name" attribute of the Content-Type header.

1 parent 5c6c39ac
Showing 1 changed file with 27 additions and 2 deletions
...@@ -1579,12 +1579,13 @@ store_handler (message_t msg, msg_part_t part, char *type, char *encoding, ...@@ -1579,12 +1579,13 @@ store_handler (message_t msg, msg_part_t part, char *type, char *encoding,
1579 header_t hdr; 1579 header_t hdr;
1580 char *val; 1580 char *val;
1581 1581
1582 if (message_get_header (msg, &hdr) == 0 1582 if (message_get_header (msg, &hdr) == 0)
1583 && header_aget_value (hdr, MU_HEADER_CONTENT_DISPOSITION, &val) == 0)
1584 { 1583 {
1585 int argc; 1584 int argc;
1586 char **argv; 1585 char **argv;
1587 1586
1587 if (header_aget_value (hdr, MU_HEADER_CONTENT_DISPOSITION, &val) == 0)
1588 {
1588 if (argcv_get (val, "=", NULL, &argc, &argv) == 0) 1589 if (argcv_get (val, "=", NULL, &argc, &argv) == 0)
1589 { 1590 {
1590 int i; 1591 int i;
...@@ -1604,6 +1605,30 @@ store_handler (message_t msg, msg_part_t part, char *type, char *encoding, ...@@ -1604,6 +1605,30 @@ store_handler (message_t msg, msg_part_t part, char *type, char *encoding,
1604 } 1605 }
1605 free (val); 1606 free (val);
1606 } 1607 }
1608
1609 if (!name
1610 && header_aget_value (hdr, MU_HEADER_CONTENT_TYPE, &val) == 0) {
1611 if (argcv_get (val, "=", NULL, &argc, &argv) == 0)
1612 {
1613 int i;
1614
1615 for (i = 0; i < argc; i++)
1616 {
1617 if ((strcmp (argv[i], "filename") == 0
1618 || strcmp (argv[i], "name") == 0)
1619 && ++i < argc
1620 && argv[i][0] == '='
1621 && ++i < argc)
1622 {
1623 name = normalize_path (dir, argv[i]);
1624 break;
1625 }
1626 }
1627 argcv_free (argc, argv);
1628 }
1629 free (val);
1630 }
1631 }
1607 } 1632 }
1608 1633
1609 if (!name) 1634 if (!name)
......