[Commits] [SCM] claws branch, gtk3, updated. 3.99.0-36-ged02deed2

mones at claws-mail.org mones at claws-mail.org
Sun Feb 7 13:26:35 UTC 2021


The branch, gtk3 has been updated
       via  ed02deed2544d6509aa725d1858dcb3271332836 (commit)
      from  e8ccd6c449430e3b775f09e27ec8f1ad000def33 (commit)

Summary of changes:
 src/plugins/fancy/fancy_viewer.c | 31 +++++++++++++++++++++++++++++++
 1 file changed, 31 insertions(+)


- Log -----------------------------------------------------------------
commit ed02deed2544d6509aa725d1858dcb3271332836
Author: Steve Randall <srandall52 at sbcglobal.net>
Date:   Tue Feb 2 16:53:09 2021 -0600

    Fix bug #4440: content referenced by CID not being loaded

diff --git a/src/plugins/fancy/fancy_viewer.c b/src/plugins/fancy/fancy_viewer.c
index 67cd59825..9fcce4756 100644
--- a/src/plugins/fancy/fancy_viewer.c
+++ b/src/plugins/fancy/fancy_viewer.c
@@ -463,6 +463,34 @@ navigation_policy_cb (WebKitWebView    *web_view,
 	return true;
 }
 
+static void load_content_cb(WebKitURISchemeRequest *request, gpointer viewer)
+{
+	gchar *image;
+	MimeInfo *partinfo = ((FancyViewer *)viewer)->to_load;
+	gchar *mimetype;
+	GInputStream *stream;
+	GError *error;
+
+	image = g_strconcat("<", webkit_uri_scheme_request_get_path(request), ">", NULL);
+	while ((partinfo = procmime_mimeinfo_next(partinfo)) != NULL) {
+		if (partinfo->id && !g_ascii_strcasecmp(image, partinfo->id)) {
+			mimetype = procmime_get_content_type_str(partinfo->type, partinfo->subtype);
+			stream = procmime_get_part_as_inputstream(partinfo);
+			webkit_uri_scheme_request_finish(request, stream, partinfo->length,
+					mimetype);
+			g_object_unref(stream);
+			g_free(mimetype);
+			g_free(image);
+			return;
+		}
+	}
+
+	error = g_error_new(0, 0, _("Couldn't save the part of multipart message: %s"), image);
+	webkit_uri_scheme_request_finish_error(request, error);
+	g_error_free(error);
+	g_free(image);
+}
+
 static void resource_request_starting_cb(WebKitWebView		*view,
 					 WebKitWebResource	*resource,
 					 WebKitURIRequest	*request,
@@ -1182,6 +1210,9 @@ static MimeViewer *fancy_viewer_create(void)
 	g_signal_connect(G_OBJECT(viewer->view), "resource-load-failed",
 			 G_CALLBACK(resource_load_failed_cb), viewer);
 
+	webkit_web_context_register_uri_scheme(webkit_web_context_get_default(),
+			"cid", load_content_cb, viewer, NULL);
+
 	viewer->filename = NULL;
 	return (MimeViewer *) viewer;
 }

-----------------------------------------------------------------------


hooks/post-receive
-- 
Claws Mail


More information about the Commits mailing list