[balsa: 1/3] compose-window: Ensure attachment has a filename



commit 26f3924fef328d490506930f2051f9ecb4f09f64
Author: Peter Bloomfield <PeterBloomfield bellsouth net>
Date:   Sun Jul 5 12:26:48 2020 -0400

    compose-window: Ensure attachment has a filename
    
    Attachments of type "message/external-body" must have a filename,
    because libbalsa_message_create_mime_message() uses it to distinguish
    access-type=URL from access-type=local-file.
    
    * src/sendmsg-window.c (attachment2message):

 ChangeLog            | 9 +++++++++
 src/sendmsg-window.c | 8 +++-----
 2 files changed, 12 insertions(+), 5 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index c94cc4bee..a43e4e388 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2020-07-05  Peter Bloomfield  <pbloomfield bellsouth net>
+
+       compose-window: Attachments of type "message/external-body" must
+       have a filename, because libbalsa_message_create_mime_message()
+       uses it to distinguish access-type=URL from
+       access-type=local-file.
+
+       * src/sendmsg-window.c (attachment2message):
+
 2020-07-04  Peter Bloomfield  <pbloomfield bellsouth net>
 
        compose-window: Handle attachments of type
diff --git a/src/sendmsg-window.c b/src/sendmsg-window.c
index e9d6bcc62..f15a142b8 100644
--- a/src/sendmsg-window.c
+++ b/src/sendmsg-window.c
@@ -4863,11 +4863,9 @@ attachment2message(GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter,
 
     /* create the attachment */
     body = libbalsa_message_body_new(message);
-    body->file_uri = attachment->file_uri;
-    if (attachment->file_uri)
-        g_object_ref(attachment->file_uri);
-    else
-        body->filename = g_strdup(attachment->uri_ref);
+    if (attachment->file_uri != NULL)
+        body->file_uri = g_object_ref(attachment->file_uri);
+    body->filename = g_strdup(attachment->uri_ref);
     body->content_type = g_strdup(attachment->force_mime_type);
     body->charset = g_strdup(attachment->charset);
     body->attach_mode = attachment->mode;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]