[evolution-rss] do not try to fetch non-image files
- From: Lucian Langa <lucilanga src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-rss] do not try to fetch non-image files
- Date: Thu, 17 Mar 2011 20:14:00 +0000 (UTC)
commit 01754e9a3750e4182ceca685b69fce3eb351e98b
Author: Lucian Langa <lucilanga gnome org>
Date: Thu Mar 17 22:10:47 2011 +0200
do not try to fetch non-image files
src/rss-image.c | 13 +++++++++++--
1 files changed, 11 insertions(+), 2 deletions(-)
---
diff --git a/src/rss-image.c b/src/rss-image.c
index 1051048..32024c3 100644
--- a/src/rss-image.c
+++ b/src/rss-image.c
@@ -286,22 +286,31 @@ finish_image_feedback (SoupSession *soup_sess, SoupMessage *msg, FEED_IMAGE *use
#endif
{
CamelStream *stream = NULL;
+ gchar *mime_type;
stream = rss_cache_add(user_data->url);
finish_image(soup_sess, msg, stream);
if (!missing)
missing = g_hash_table_new_full(
g_str_hash, g_str_equal, g_free, NULL);
+ mime_type = g_content_type_guess(NULL,
+ (guchar *)msg->response_body->data,
+ msg->response_body->length, NULL);
+
if (503 == msg->status_code || //handle this timedly fasion
404 == msg->status_code || //NOT FOUND
400 == msg->status_code || //bad request
2 == msg->status_code || //STATUS_CANT_RESOLVE
1 == msg->status_code || //TIMEOUT (CANCELLED) ?
7 == msg->status_code ||// STATUS_IO_ERROR
- msg->response_body->length) { //ZERO SIZE
+ msg->response_body->length || //ZERO SIZE
+ /*FIXME mime type here could be wrong */
+ 0 != g_ascii_strncasecmp (mime_type, "image/", 6)) { //ZERO SIZE
g_hash_table_insert(missing,
- g_strdup(user_data->url), GINT_TO_POINTER(1));
+ g_strdup(user_data->url),
+ GINT_TO_POINTER(1));
}
+ g_free(mime_type);
if (user_data->data == current_pobject)
#if EVOLUTION_VERSION >= 23190
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]