From 4ff158caeaac3e5ef652bcb29bfb523ad6c97909 Mon Sep 17 00:00:00 2001 From: Kolja Lampe Date: Fri, 12 Jun 2026 14:54:37 +0200 Subject: [PATCH] http: Propagate stream write failures to curl We did not report the written bytes of the aborted stream before - so curl thought that we wrote all bytes. --- common/flatpak-utils-http.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/common/flatpak-utils-http.c b/common/flatpak-utils-http.c index 33a2a8502..af3081dc5 100644 --- a/common/flatpak-utils-http.c +++ b/common/flatpak-utils-http.c @@ -485,9 +485,10 @@ _write_cb (void *content_data, } else if (data->out) { - /* We ignore the error here, but reporting a short read will make curl report the error */ - g_output_stream_write_all (data->out, content_data, realsize, - &n_written, NULL, NULL); + /* Returning a short write makes curl report CURLE_WRITE_ERROR. */ + if (!g_output_stream_write_all (data->out, content_data, realsize, + &n_written, NULL, NULL)) + return n_written; } data->downloaded_bytes += realsize;