[gnome-software: 2/3] odrs-provider: Strip some strings
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software: 2/3] odrs-provider: Strip some strings
- Date: Tue, 1 Mar 2022 17:32:02 +0000 (UTC)
commit f30a5e6d39f1662144d0039548d0da443c2c2dd1
Author: Adrien Plazas <kekun plazas laposte net>
Date: Tue Mar 1 14:21:09 2022 +0100
odrs-provider: Strip some strings
This strips the reviewer name, the summary and the description to keep
the strings somewhat sane.
lib/gs-odrs-provider.c | 21 +++++++++++++++------
1 file changed, 15 insertions(+), 6 deletions(-)
---
diff --git a/lib/gs-odrs-provider.c b/lib/gs-odrs-provider.c
index 3c6ca084f..d110c37e2 100644
--- a/lib/gs-odrs-provider.c
+++ b/lib/gs-odrs-provider.c
@@ -218,12 +218,21 @@ gs_odrs_provider_parse_review_object (JsonObject *item)
}
if (json_object_has_member (item, "user_hash"))
as_review_set_reviewer_id (rev, json_object_get_string_member (item, "user_hash"));
- if (json_object_has_member (item, "user_display"))
- as_review_set_reviewer_name (rev, json_object_get_string_member (item, "user_display"));
- if (json_object_has_member (item, "summary"))
- as_review_set_summary (rev, json_object_get_string_member (item, "summary"));
- if (json_object_has_member (item, "description"))
- as_review_set_description (rev, json_object_get_string_member (item, "description"));
+ if (json_object_has_member (item, "user_display")) {
+ g_autofree gchar *user_display = g_strdup (json_object_get_string_member (item,
"user_display"));
+ g_strstrip (user_display);
+ as_review_set_reviewer_name (rev, user_display);
+ }
+ if (json_object_has_member (item, "summary")) {
+ g_autofree gchar *summary = g_strdup (json_object_get_string_member (item, "summary"));
+ g_strstrip (summary);
+ as_review_set_summary (rev, summary);
+ }
+ if (json_object_has_member (item, "description")) {
+ g_autofree gchar *description = g_strdup (json_object_get_string_member (item,
"description"));
+ g_strstrip (description);
+ as_review_set_description (rev, description);
+ }
if (json_object_has_member (item, "version"))
as_review_set_version (rev, json_object_get_string_member (item, "version"));
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]