diff src/msg.cpp @ 331:c5e7f13d2836

.msg files should use only one of short or long filename fields
author Carl Byington <carl@five-ten-sg.com>
date Thu, 25 Jul 2013 11:12:57 -0700
parents 3e6cdd543857
children 1c458f13d1d3
line wrap: on
line diff
--- a/src/msg.cpp	Wed Jun 12 21:34:35 2013 -0700
+++ b/src/msg.cpp	Thu Jul 25 11:12:57 2013 -0700
@@ -381,8 +381,19 @@
                     GsfOutfile *out = GSF_OUTFILE (output);
                     string_property(out, prop_list, 0x0FF90102, item->record_key);
                     string_property(out, prop_list, 0x37010102, fp);
-                    string_property(out, prop_list, 0x3704001E, body_charset, a->filename1);
-                    string_property(out, prop_list, 0x3707001E, body_charset, a->filename2);
+                    if (a->filename2.str) {
+                        // have long file name
+                        string_property(out, prop_list, 0x3707001E, body_charset, a->filename2);
+                    }
+                    else if (a->filename1.str) {
+                        // have short file name
+                        string_property(out, prop_list, 0x3704001E, body_charset, a->filename1);
+                    }
+                    else {
+                        // make up a name
+                        const char *n = "inline";
+                        string_property(out, prop_list, 0x3704001E, n, strlen(n));
+                    }
                     string_property(out, prop_list, 0x370E001E, body_charset, a->mimetype);
                     write_properties(out, prop_list, (const guint8*)&top_head, 8);  // convenient 8 bytes of reserved zeros
                     gsf_output_close(output);