504688b143
This is an automated DistroBaker update from upstream sources. If you do not know what this is about or would like to opt out, contact the OSCI team. Source: https://src.fedoraproject.org/rpms/gnome-software.git#dbac9fa7a31701e5c4e70faa75ee216c66053da5
49 lines
1.6 KiB
Diff
49 lines
1.6 KiB
Diff
From 9a63168893a678f97fe6e3bfde2d6e5debf151c3 Mon Sep 17 00:00:00 2001
|
||
From: Philip Withnall <pwithnall@endlessos.org>
|
||
Date: Tue, 16 Mar 2021 13:34:13 +0000
|
||
Subject: [PATCH 2/4] =?UTF-8?q?gs-appstream:=20Fix=20handling=20of=20icons?=
|
||
=?UTF-8?q?=20where=20appdata=20doesn=E2=80=99t=20specify=20width?=
|
||
MIME-Version: 1.0
|
||
Content-Type: text/plain; charset=UTF-8
|
||
Content-Transfer-Encoding: 8bit
|
||
|
||
If the `<icon>` element in the appdata doesn’t specify a `width`
|
||
attribute, `xb_node_get_attr_as_uint()` will return `G_MAXUINT64`.
|
||
However, its return value was being assigned to `sz`, which is a
|
||
`guint`, and hence it was being truncated. This resulted in icons having
|
||
their widths set to `G_MAXUINT`, and hence being prioritised for display
|
||
when that was not necessarily correct.
|
||
|
||
Fix that by explicitly handling the failure response from
|
||
`xb_node_get_attr_as_uint()`.
|
||
|
||
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
|
||
|
||
Fixes: #1171
|
||
---
|
||
plugins/core/gs-appstream.c | 8 ++++++--
|
||
1 file changed, 6 insertions(+), 2 deletions(-)
|
||
|
||
diff --git a/plugins/core/gs-appstream.c b/plugins/core/gs-appstream.c
|
||
index a9cf97270..22fed1154 100644
|
||
--- a/plugins/core/gs-appstream.c
|
||
+++ b/plugins/core/gs-appstream.c
|
||
@@ -149,8 +149,12 @@ gs_appstream_new_icon (XbNode *component, XbNode *n, AsIconKind icon_kind, guint
|
||
default:
|
||
as_icon_set_name (icon, xb_node_get_text (n));
|
||
}
|
||
- if (sz == 0)
|
||
- sz = xb_node_get_attr_as_uint (n, "width");
|
||
+ if (sz == 0) {
|
||
+ guint64 width = xb_node_get_attr_as_uint (n, "width");
|
||
+ if (width > 0 && width < G_MAXUINT)
|
||
+ sz = width;
|
||
+ }
|
||
+
|
||
if (sz > 0) {
|
||
as_icon_set_width (icon, sz);
|
||
as_icon_set_height (icon, sz);
|
||
--
|
||
2.30.2
|
||
|