htmail-view icon indicating copy to clipboard operation
htmail-view copied to clipboard

in-line images (cid:XXXXXXXX) not loading

Open hmrct opened this issue 5 years ago • 3 comments

Per the author's comment in "v0.6 loads images unconditionally", we have:

"In WebKit there was the resource-request-starting signal but WebKit2 only has the resource-load-started signal. The latter is called after beginning to download additional resources..."

The key word there is "after". This translates to "too late" to affect the loading of the "file://" resource corresponding to the original "cid:XXXXXXXX" URL. In verbose mode, it is clear that appropriate remapping of "cid:XXXXXXXX --> file://(something)" is happening, but there needs to be some way to catch the "notify::response" signal and load the remapped resource. I think what needs to happen is similar to the "lbh_resource_notify_response_cb()" function in "balsa/html.c", but I can't figure out a way to accomplish this using the perl Gtk 3.0 and WebKit2 4.0 interface.

Part of why I can't figure out how to do this is not knowing how C function definitions such as "webkit_web_view_load_uri (WebKitWebView *web_view, const gchar *uri);" map to Perl statements like "$view->load_uri($uri->as_string);" in the general case via the introspection typelibs. Is there some kind of typelib "explorer" that would allow browsing of functions, methods, objects, structures, etc.?

Thanks in advance for any assistance provided.

hmrct avatar Sep 18 '19 19:09 hmrct

Quick follow-up... I've been searching for ways to force a reload of a resource after the corresponding URI has been changed. So far, no luck. I briefly thought I could register the "cid" scheme in the view's context, and use the callback function to rewrite the URI prior to loading, but the scheme callback function doesn't get executed until after the "resource-load-started" signal has been received. As mentioned in my earlier comment, that's too late.

I don't think we can "get there from here" without doing the URI rewriting prior to calling "$view->load_uri($uri->as_string);". I suppose it's possible to rewrite the "text/html" message body in "htmail-decode" (or even in "htmail-view") before loading the main URI, but I realize we're trying to avoid that and do the rewriting on-the-fly.

hmrct avatar Sep 19 '19 17:09 hmrct

Interesting topic, loading inline images was exactly the thing I was looking for (especially for images self-contained in the email), did you find a solution @hmrct ?

edi9999 avatar Dec 28 '19 19:12 edi9999

I don't think we can "get there from here" without doing the URI rewriting prior to calling "$view->load_uri($uri->as_string);". I suppose it's possible to rewrite the "text/html" message body in "htmail-decode" (or even in "htmail-view") before loading the main URI, but I realize we're trying to avoid that and do the rewriting on-the-fly.

We need html parsing to find and replace the links and it might be fragile with broken html mails. But this might be (the only?) possible workaround for this issue AFAIK.

liske avatar Jun 27 '20 08:06 liske