Don't consider message HTML using class="body" for remote image updates.

If a message body also uses class="body" on an element containing a
remote image, then the IMG element wil be processed more than once and
the allow_prefix added more than once, breaking remote image load.

Bug 764919

* src/client/conversation-viewer/conversation-viewer.vala
  (show_images_email): Use Util.DOM.select to ensure we only get the
  Geary .body element, and not any in the HTML of the message body. Do
  the same for the remote_images DIV.
This commit is contained in:
Michael James Gratton 2016-04-12 12:23:40 +10:00 committed by Adam Dingle
parent 15b1632d17
commit 4625e94728

View file

@ -1480,12 +1480,10 @@ public class ConversationViewer : Gtk.Box {
private void show_images_email(WebKit.DOM.Element email_element, bool remember) {
try {
WebKit.DOM.NodeList body_nodes = email_element.query_selector_all(".body");
for (ulong j = 0; j < body_nodes.length; j++) {
WebKit.DOM.Element? body = body_nodes.item(j) as WebKit.DOM.Element;
if (body == null)
continue;
WebKit.DOM.Element body = Util.DOM.select(email_element, ".body");
if (body == null) {
warning("Could not find message body");
} else {
WebKit.DOM.NodeList nodes = body.query_selector_all("img");
for (ulong i = 0; i < nodes.length; i++) {
WebKit.DOM.Element? element = nodes.item(i) as WebKit.DOM.Element;
@ -1501,7 +1499,7 @@ public class ConversationViewer : Gtk.Box {
}
}
WebKit.DOM.Element? remote_images = email_element.query_selector(".remote_images");
WebKit.DOM.Element? remote_images = Util.DOM.select(email_element, ".remote_images");
if (remote_images != null)
remote_images.get_class_list().remove("show");
} catch (Error error) {