aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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: