[geary] Don't load Gravatar icons unless a HTTP 200 response is receieved.
- From: Michael Gratton <mjog src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [geary] Don't load Gravatar icons unless a HTTP 200 response is receieved.
- Date: Sat, 8 Oct 2016 10:20:51 +0000 (UTC)
commit 83c383ddd20c7c4f5b73d0f6f6144d212d92241e
Author: Michael James Gratton <mike vee net>
Date: Sat Oct 8 21:20:40 2016 +1100
Don't load Gravatar icons unless a HTTP 200 response is receieved.
Bug 765516
* src/client/conversation-viewer/conversation-message.vala
(ConversationMessage::load_avatar): Check HTTP response before loading
the icon.
* src/client/conversation-viewer/conversation-message.vala (set_avatar):
Don't bother trying to catch any GdkPixbuf error, just pass it up the
call chain.
.../conversation-viewer/conversation-message.vala | 17 ++++++-----------
1 files changed, 6 insertions(+), 11 deletions(-)
---
diff --git a/src/client/conversation-viewer/conversation-message.vala
b/src/client/conversation-viewer/conversation-message.vala
index 53a807f..229c52d 100644
--- a/src/client/conversation-viewer/conversation-message.vala
+++ b/src/client/conversation-viewer/conversation-message.vala
@@ -447,11 +447,11 @@ public class ConversationMessage : Gtk.Grid {
try {
InputStream data =
yield session.send_async(message, load_cancelled);
- if (data != null) {
+ if (data != null && message.status_code == 200) {
yield set_avatar(data, load_cancelled);
}
} catch (Error err) {
- debug("Unable to load avatar: %s", err.message);
+ debug("Error loading Gravatar response: %s", err.message);
}
}
}
@@ -783,15 +783,10 @@ public class ConversationMessage : Gtk.Grid {
}
private async void set_avatar(InputStream data,
- Cancellable load_cancelled) {
- Gdk.Pixbuf avatar_buf = null;
- try {
- avatar_buf = yield Gdk.Pixbuf.new_from_stream_async(
- data, load_cancelled
- );
- } catch (Error err) {
- debug("Error loading Gravatar response: %s", err.message);
- }
+ Cancellable load_cancelled)
+ throws Error {
+ Gdk.Pixbuf avatar_buf =
+ yield Gdk.Pixbuf.new_from_stream_async(data, load_cancelled);
if (avatar_buf != null && !load_cancelled.is_cancelled()) {
int window_scale = get_scale_factor();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]