diff options
| author | Matthias Clasen <mclasen@redhat.com> | 2019-02-01 12:04:05 -0500 |
|---|---|---|
| committer | Atomic Bot <atomic-devel@projectatomic.io> | 2019-02-02 00:52:32 +0000 |
| commit | 228ee0bd0a2b8e3fbbedee516f03106e346cb8b6 (patch) | |
| tree | d3b9465a80490ea82dceb6f7f74f8dab6ff0968d | |
| parent | 8d4fa873c23d6a4b71aae136ab8c348b7a009448 (diff) | |
| download | flatpak-228ee0bd0a2b8e3fbbedee516f03106e346cb8b6.tar.gz | |
appdata: Ignore allowed attributes
We only interested in a few of the attributes of some
tags, but we shouldn't fail if other valid attributes
are present.
Add some of the allowed attributes to the <release> element
in the appdata test and verify that we can still parse it.
The appstream spec is here:
https://www.freedesktop.org/software/appstream/docs/
Closes: #2674
Approved by: matthiasclasen
| -rw-r--r-- | common/flatpak-appdata.c | 5 | ||||
| -rw-r--r-- | tests/testcommon.c | 2 |
2 files changed, 5 insertions, 2 deletions
diff --git a/common/flatpak-appdata.c b/common/flatpak-appdata.c index e635e6a1..d5ce2ee4 100644 --- a/common/flatpak-appdata.c +++ b/common/flatpak-appdata.c @@ -148,9 +148,12 @@ start_element (GMarkupParseContext *context, attribute_names, attribute_values, error, + G_MARKUP_COLLECT_STRING, "version", &version, G_MARKUP_COLLECT_STRING | G_MARKUP_COLLECT_OPTIONAL, "timestamp", ×tamp, G_MARKUP_COLLECT_STRING | G_MARKUP_COLLECT_OPTIONAL, "date", &date, - G_MARKUP_COLLECT_STRING, "version", &version, + G_MARKUP_COLLECT_STRING | G_MARKUP_COLLECT_OPTIONAL, "date_eol", NULL, + G_MARKUP_COLLECT_STRING | G_MARKUP_COLLECT_OPTIONAL, "urgency", NULL, + G_MARKUP_COLLECT_STRING | G_MARKUP_COLLECT_OPTIONAL, "type", NULL, G_MARKUP_COLLECT_INVALID)) { guint64 ts = 0; diff --git a/tests/testcommon.c b/tests/testcommon.c index 0c28298b..f96013db 100644 --- a/tests/testcommon.c +++ b/tests/testcommon.c @@ -473,7 +473,7 @@ test_parse_appdata (void) " <release timestamp=\"1525132800\" version=\"0.1.0\"/>\n" " <release timestamp=\"1525000800\" date=\"2018-05-02\" version=\"0.0.2\"/>\n" " <release date=\"2017-05-02\" version=\"0.0.3\"/>\n" - " <release timestamp=\"1000000000\" version=\"0.0.1\"/>\n" + " <release timestamp=\"1000000000\" version=\"0.0.1\" type=\"stable\" urgency=\"low\"/>\n" " </releases>\n" " <project_license>anything goes</project_license>\n" " </component>\n" |
