[evolution-rss] hide broken image in case images are corrupted
- From: Lucian Langa <lucilanga src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-rss] hide broken image in case images are corrupted
- Date: Fri, 18 Jun 2010 20:38:48 +0000 (UTC)
commit de4e32ec75074f84816f905c96b4b0bbe1fd00bc
Author: Lucian Langa <lucilanga gnome org>
Date: Thu Jun 17 20:15:42 2010 +0300
hide broken image in case images are corrupted
TODO | 1 +
src/rss-image.c | 27 +++++++++++++++------------
2 files changed, 16 insertions(+), 12 deletions(-)
---
diff --git a/TODO b/TODO
index 00bea56..e6f000a 100644
--- a/TODO
+++ b/TODO
@@ -40,3 +40,4 @@
* add select all for feed list or perhaps delete all - manually select each record and pressing delete is a pain on a 10000 feed list - abitily to select just for deletion
* check key->session big memleak ?
* markup fail perhaps in web auth dialog
+ * nice to add progressive downloading of images
diff --git a/src/rss-image.c b/src/rss-image.c
index 9a37b72..23a96b6 100644
--- a/src/rss-image.c
+++ b/src/rss-image.c
@@ -487,7 +487,7 @@ verify_image(gchar *uri, EMFormatHTML *format)
g_return_val_if_fail(uri != NULL, NULL);
if (strstr(uri, "img:"))
- duri = (gchar *)g_base64_decode(uri+4, &size);
+ duri = decode_image_cache_filename(uri);
if (!g_file_test(duri, G_FILE_TEST_EXISTS)) {
camel_url_decode((gchar *)uri);
@@ -511,6 +511,8 @@ verify_image(gchar *uri, EMFormatHTML *format)
name = fetch_image_redraw(turl, NULL, format);
g_free(nurl);
} else {
+ if (!strcmp(scheme, "file"))
+ goto fail;
turl = uri;
name = fetch_image_redraw(uri, NULL, format);
g_free(scheme);
@@ -534,22 +536,14 @@ verify_image(gchar *uri, EMFormatHTML *format)
* bound to be wrong, especially on files fetched from the web
* this is very important as we might get quite a few images
* missing otherwise */
- g_file_get_contents (duri ? duri:uri,
+ g_file_get_contents (duri?duri:uri,
&contents,
&length,
NULL);
mime_type = g_content_type_guess(NULL, (guchar *)contents, length, NULL);
/*FIXME mime type here could be wrong */
- if (g_ascii_strncasecmp (mime_type, "image/", 6)) {
-#if (EVOLUTION_VERSION >= 23000)
- result = g_filename_to_uri (pixfile, NULL, NULL);
-#else
- result = g_strdup(pixfile);
-#endif
- if (duri)
- g_free(duri);
- return result;
- }
+ if (g_ascii_strncasecmp (mime_type, "image/", 6))
+ goto fail;
g_free(mime_type);
g_free(contents);
/*
@@ -563,6 +557,15 @@ verify_image(gchar *uri, EMFormatHTML *format)
return NULL;
#endif
}
+fail:
+#if (EVOLUTION_VERSION >= 23000)
+ result = g_filename_to_uri (pixfile, NULL, NULL);
+#else
+ result = g_strdup(pixfile);
+#endif
+ if (duri)
+ g_free(duri);
+ return result;
}
// constructs url from @base in case url is relative
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]