aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMilan Crha <mcrha@redhat.com>2009-02-11 17:54:05 +0800
committerMilan Crha <mcrha@src.gnome.org>2009-02-11 17:54:05 +0800
commitec49abcb7ce88f0549fa54a66d4523e5a355b942 (patch)
tree39d0832d20dbc515ada540e467f12a35aec49d3a
parentaf9c978259a22fae6c21eaf3d886b04cf4a96e60 (diff)
downloadgsoc2013-evolution-ec49abcb7ce88f0549fa54a66d4523e5a355b942.tar
gsoc2013-evolution-ec49abcb7ce88f0549fa54a66d4523e5a355b942.tar.gz
gsoc2013-evolution-ec49abcb7ce88f0549fa54a66d4523e5a355b942.tar.bz2
gsoc2013-evolution-ec49abcb7ce88f0549fa54a66d4523e5a355b942.tar.lz
gsoc2013-evolution-ec49abcb7ce88f0549fa54a66d4523e5a355b942.tar.xz
gsoc2013-evolution-ec49abcb7ce88f0549fa54a66d4523e5a355b942.tar.zst
gsoc2013-evolution-ec49abcb7ce88f0549fa54a66d4523e5a355b942.zip
** Fix for bug #333716
2009-02-11 Milan Crha <mcrha@redhat.com> ** Fix for bug #333716 * em-format-html.c: (emfh_gethttp): Do not store incomplete or broken files in a cache. svn path=/trunk/; revision=37244
-rw-r--r--mail/ChangeLog7
-rw-r--r--mail/em-format-html.c17
2 files changed, 15 insertions, 9 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog
index 8b68dd5b49..58e8f63f12 100644
--- a/mail/ChangeLog
+++ b/mail/ChangeLog
@@ -1,3 +1,10 @@
+2009-02-11 Milan Crha <mcrha@redhat.com>
+
+ ** Fix for bug #333716
+
+ * em-format-html.c: (emfh_gethttp):
+ Do not store incomplete or broken files in a cache.
+
2009-02-10 Milan Crha <mcrha@redhat.com>
* em-format-html-display.c: (efhd_format_secure):
diff --git a/mail/em-format-html.c b/mail/em-format-html.c
index f813ef01fb..21cbcf0e92 100644
--- a/mail/em-format-html.c
+++ b/mail/em-format-html.c
@@ -533,17 +533,12 @@ static void emfh_gethttp(struct _EMFormatHTMLJob *job, int cancelled)
camel_operation_progress(NULL, pc_complete);
}
d(printf(" read %d bytes\n", n));
- if (costream && camel_stream_write(costream, buffer, n) == -1) {
- camel_data_cache_remove(emfh_http_cache, EMFH_HTTP_CACHE_PATH, job->u.uri, NULL);
- camel_object_unref(costream);
- costream = NULL;
+ if (costream && camel_stream_write (costream, buffer, n) == -1) {
+ n = -1;
+ break;
}
camel_stream_write(job->stream, buffer, n);
- } else if (n < 0 && costream) {
- camel_data_cache_remove(emfh_http_cache, EMFH_HTTP_CACHE_PATH, job->u.uri, NULL);
- camel_object_unref(costream);
- costream = NULL;
}
} while (n>0);
@@ -551,8 +546,12 @@ static void emfh_gethttp(struct _EMFormatHTMLJob *job, int cancelled)
if (n == 0)
camel_stream_close(job->stream);
- if (costream)
+ if (costream) {
+ /* do not store broken files in a cache */
+ if (n != 0)
+ camel_data_cache_remove(emfh_http_cache, EMFH_HTTP_CACHE_PATH, job->u.uri, NULL);
camel_object_unref(costream);
+ }
camel_object_unref(instream);
done: