summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Hughes <richard@hughsie.com>2019-05-14 13:28:18 +0100
committerRichard Hughes <richard@hughsie.com>2019-05-14 13:47:11 +0100
commit0ce2e0b8e8d2dd9be986a7fced0450aa71f181bd (patch)
tree105e03b630d883eda60120aa756522b16210a137
parentec6265d3ab0999db35ba43e60f4ee49efcd1b4b3 (diff)
downloadappstream-glib-0ce2e0b8e8d2dd9be986a7fced0450aa71f181bd.tar.gz
Do not require <update_contact> for validation unless strict
Fixes some of https://github.com/hughsie/appstream-glib/issues/302
-rw-r--r--libappstream-glib/as-app-validate.c4
-rw-r--r--libappstream-glib/as-self-test.c8
2 files changed, 4 insertions, 8 deletions
diff --git a/libappstream-glib/as-app-validate.c b/libappstream-glib/as-app-validate.c
index 04c4332..a8b4b74 100644
--- a/libappstream-glib/as-app-validate.c
+++ b/libappstream-glib/as-app-validate.c
@@ -1190,7 +1190,7 @@ as_app_validate (AsApp *app, guint32 flags, GError **error)
const gchar *update_contact;
gboolean deprecated_failure = FALSE;
gboolean require_appstream_spec_only = FALSE;
- gboolean require_contactdetails = TRUE;
+ gboolean require_contactdetails = FALSE;
gboolean require_copyright = FALSE;
gboolean require_description = FALSE;
gboolean require_project_license = FALSE;
@@ -1235,7 +1235,6 @@ as_app_validate (AsApp *app, guint32 flags, GError **error)
if ((flags & AS_APP_VALIDATE_FLAG_RELAX) > 0) {
length_name_max = 100;
length_summary_max = 200;
- require_contactdetails = FALSE;
require_content_license = FALSE;
validate_license = FALSE;
require_url = FALSE;
@@ -1264,6 +1263,7 @@ as_app_validate (AsApp *app, guint32 flags, GError **error)
require_appstream_spec_only = TRUE;
require_sentence_case = TRUE;
require_name_shorter_than_summary = TRUE;
+ require_contactdetails = TRUE;
number_para_min = 2;
number_para_max = 4;
}
diff --git a/libappstream-glib/as-self-test.c b/libappstream-glib/as-self-test.c
index d065256..ce00247 100644
--- a/libappstream-glib/as-self-test.c
+++ b/libappstream-glib/as-self-test.c
@@ -2266,8 +2266,6 @@ as_test_app_validate_file_bad_func (void)
"<metadata_license> is not valid");
as_test_app_validate_check (probs, AS_PROBLEM_KIND_TAG_INVALID,
"<project_license> is not valid");
- as_test_app_validate_check (probs, AS_PROBLEM_KIND_TAG_MISSING,
- "<update_contact> is not present");
as_test_app_validate_check (probs, AS_PROBLEM_KIND_TAG_INVALID,
"<url> does not start with 'http://'");
as_test_app_validate_check (probs, AS_PROBLEM_KIND_MARKUP_INVALID,
@@ -2307,7 +2305,7 @@ as_test_app_validate_file_bad_func (void)
"<release> timestamp is in the future");
as_test_app_validate_check (probs, AS_PROBLEM_KIND_MARKUP_INVALID,
"<id> has invalid character");
- g_assert_cmpint (probs->len, ==, 23);
+ g_assert_cmpint (probs->len, ==, 22);
/* again, harder */
probs2 = as_app_validate (app, AS_APP_VALIDATE_FLAG_STRICT, &error);
@@ -2343,7 +2341,7 @@ as_test_app_validate_meta_bad_func (void)
problem = g_ptr_array_index (probs, i);
g_debug ("%s", as_problem_get_message (problem));
}
- g_assert_cmpint (probs->len, ==, 7);
+ g_assert_cmpint (probs->len, ==, 6);
as_test_app_validate_check (probs, AS_PROBLEM_KIND_TAG_MISSING,
"<name> is not present");
as_test_app_validate_check (probs, AS_PROBLEM_KIND_TAG_MISSING,
@@ -2351,8 +2349,6 @@ as_test_app_validate_meta_bad_func (void)
as_test_app_validate_check (probs, AS_PROBLEM_KIND_TAG_MISSING,
"<url> is not present");
as_test_app_validate_check (probs, AS_PROBLEM_KIND_TAG_MISSING,
- "<update_contact> is not present");
- as_test_app_validate_check (probs, AS_PROBLEM_KIND_TAG_MISSING,
"<extends> is not present");
as_test_app_validate_check (probs, AS_PROBLEM_KIND_TAG_MISSING,
"<metadata_license> is not present");