Show the 4XX download failure in the error output

This commit is contained in:
Richard Hughes 2023-02-13 20:32:32 +00:00
parent 5444131703
commit be45a3a773

View File

@ -5152,6 +5152,16 @@ fwupd_client_download_http(FwupdClient *self, CURL *curl, const gchar *url, GErr
return NULL;
}
if (status_code >= 400) {
g_autofree gchar *str = g_strndup((const gchar *)buf->data, MIN(buf->len, 4000));
if (g_str_is_ascii(str)) {
g_set_error(error,
FWUPD_ERROR,
FWUPD_ERROR_INVALID_FILE,
"Failed to download, server response was %u: %s",
(guint)status_code,
str);
return NULL;
}
g_set_error(error,
FWUPD_ERROR,
FWUPD_ERROR_INVALID_FILE,