if image attachment doesn't have a "name", show "filename" instead
authorPaul <paul@claws-mail.org>
Sun, 1 Dec 2019 12:52:43 +0000 (12:52 +0000)
committerPaul <paul@claws-mail.org>
Sun, 1 Dec 2019 12:52:43 +0000 (12:52 +0000)
src/image_viewer.c

index c37fd22..6a0ce40 100644 (file)
@@ -177,7 +177,9 @@ static void image_viewer_show_mimepart(MimeViewer *_mimeviewer, const gchar *fil
        imageviewer->mimeinfo = mimeinfo;
 
        gtk_label_set_text(GTK_LABEL(imageviewer->filename),
-                          procmime_mimeinfo_get_parameter(mimeinfo, "name"));
+                          (procmime_mimeinfo_get_parameter(mimeinfo, "name") != NULL)?
+                          procmime_mimeinfo_get_parameter(mimeinfo, "name") :
+                          procmime_mimeinfo_get_parameter(mimeinfo, "filename"));
        gtk_label_set_text(GTK_LABEL(imageviewer->filesize), to_human_readable((goffset)mimeinfo->length));
        gtk_label_set_text(GTK_LABEL(imageviewer->content_type), mimeinfo->subtype);
        gtk_label_set_text(GTK_LABEL(imageviewer->error_lbl), "");