File bgo-333716-load-images-html.patch of Package evolution

Index: mail/em-format-html.c
===================================================================
--- mail/em-format-html.c	(revision 37227)
+++ mail/em-format-html.c	(working copy)
@@ -531,17 +531,12 @@ static void emfh_gethttp(struct _EMForma
 				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);
 
@@ -549,8 +544,12 @@ static void emfh_gethttp(struct _EMForma
 	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:
openSUSE Build Service is sponsored by