summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBartłomiej Piotrowski <b@bpiotrowski.pl>2020-04-24 13:08:37 +0200
committerRichard Hughes <richard@hughsie.com>2020-04-24 14:16:53 +0100
commite00e4b87b71d67bca58e202b7fd5c83a77286d4e (patch)
tree9c71d056510e2f75c35e6c08920e3a44ae0de499
parentc6e9d410c21226135d5625c0fce95ea8778b39fb (diff)
downloadappstream-glib-e00e4b87b71d67bca58e202b7fd5c83a77286d4e.tar.gz
Allow timestamp in the future in validate-relax
-rw-r--r--libappstream-glib/as-app-validate.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/libappstream-glib/as-app-validate.c b/libappstream-glib/as-app-validate.c
index f50e4e4..246ef14 100644
--- a/libappstream-glib/as-app-validate.c
+++ b/libappstream-glib/as-app-validate.c
@@ -836,12 +836,14 @@ as_app_validate_release (AsApp *app,
guint number_para_max = 10;
guint number_para_min = 1;
gboolean required_timestamp = TRUE;
+ gboolean required_past_timestamp = TRUE;
const guint64 MAX_TZ_OFFSET = 14 * 60 * 60; /* UTC+14 is the biggest offset */
/* relax the requirements a bit */
if ((helper->flags & AS_APP_VALIDATE_FLAG_RELAX) > 0) {
number_para_max = 20;
required_timestamp = FALSE;
+ required_past_timestamp = FALSE;
}
/* make the requirements more strict */
@@ -871,7 +873,7 @@ as_app_validate_release (AsApp *app,
}
/* check the timestamp is not in the future */
- if (timestamp > (guint64) g_get_real_time () / G_USEC_PER_SEC + MAX_TZ_OFFSET) {
+ if (required_past_timestamp && timestamp > (guint64) g_get_real_time () / G_USEC_PER_SEC + MAX_TZ_OFFSET) {
ai_app_validate_add (helper,
AS_PROBLEM_KIND_ATTRIBUTE_INVALID,
"<release> timestamp is in the future");