summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Hughes <richard@hughsie.com>2017-08-06 08:29:57 +0100
committerRichard Hughes <richard@hughsie.com>2017-08-06 08:30:39 +0100
commit0facd796c3e2d5f5d9da0d1d4a682d30a6ffb77c (patch)
tree1676e95e873f7b29fc86aafa6aebd4a2d1494057
parent74ebf5192296f0ef26f6c51ee5f103d9fd72a3df (diff)
downloadappstream-glib-0facd796c3e2d5f5d9da0d1d4a682d30a6ffb77c.tar.gz
Do not check the suffix of <id> tags
We now have <launchable> which means the <id> is less constrained for desktop components. The checks for the other types are somewhat dubious too. Fixes: https://github.com/hughsie/appstream-glib/issues/146
-rw-r--r--libappstream-glib/as-app-validate.c47
1 files changed, 6 insertions, 41 deletions
diff --git a/libappstream-glib/as-app-validate.c b/libappstream-glib/as-app-validate.c
index bc1cf65..b8c74bf 100644
--- a/libappstream-glib/as-app-validate.c
+++ b/libappstream-glib/as-app-validate.c
@@ -1135,7 +1135,6 @@ as_app_validate (AsApp *app, AsAppValidateFlags flags, GError **error)
GHashTable *urls;
GList *l;
const gchar *description;
- const gchar *id;
const gchar *key;
const gchar *license;
const gchar *name;
@@ -1227,46 +1226,14 @@ as_app_validate (AsApp *app, AsAppValidateFlags flags, GError **error)
if (!as_app_validate_setup_networking (helper, error))
return NULL;
- /* id */
- ret = FALSE;
- id = as_app_get_id (app);
- switch (as_app_get_kind (app)) {
- case AS_APP_KIND_DESKTOP:
- case AS_APP_KIND_WEB_APP:
- if (g_str_has_suffix (id, ".desktop"))
- ret = TRUE;
- break;
- case AS_APP_KIND_INPUT_METHOD:
- if (g_str_has_suffix (id, ".xml"))
- ret = TRUE;
- else if (g_str_has_suffix (id, ".db"))
- ret = TRUE;
- break;
- case AS_APP_KIND_CODEC:
- if (g_str_has_prefix (id, "gstreamer"))
- ret = TRUE;
- break;
- case AS_APP_KIND_UNKNOWN:
+ /* invalid component type */
+ if (as_app_get_kind (app) == AS_APP_KIND_UNKNOWN) {
ai_app_validate_add (helper,
AS_PROBLEM_KIND_ATTRIBUTE_INVALID,
- "<id> has invalid type attribute");
+ "<component> has invalid type attribute");
- break;
- case AS_APP_KIND_FIRMWARE:
- if (g_str_has_suffix (id, ".firmware"))
- ret = TRUE;
- break;
- default:
- /* anything goes */
- ret = TRUE;
- break;
}
- if (!ret) {
- ai_app_validate_add (helper,
- AS_PROBLEM_KIND_MARKUP_INVALID,
- "<id> does not have correct extension for kind");
- }
- as_app_validate_check_id (helper, id);
+ as_app_validate_check_id (helper, as_app_get_id (app));
/* metadata_license */
license = as_app_get_metadata_license (app);
@@ -1278,8 +1245,7 @@ as_app_validate (AsApp *app, AsAppValidateFlags flags, GError **error)
"<metadata_license> is not valid [%s]",
license);
} else if (validate_license) {
- ret = as_app_validate_license (license, &error_local);
- if (!ret) {
+ if (!as_app_validate_license (license, &error_local)) {
g_prefix_error (&error_local,
"<metadata_license> is not valid [%s]",
license);
@@ -1306,8 +1272,7 @@ as_app_validate (AsApp *app, AsAppValidateFlags flags, GError **error)
/* project_license */
license = as_app_get_project_license (app);
if (license != NULL && validate_license) {
- ret = as_app_validate_license (license, &error_local);
- if (!ret) {
+ if (!as_app_validate_license (license, &error_local)) {
g_prefix_error (&error_local,
"<project_license> is not valid [%s]",
license);