Skip to content

Commit

Permalink
commit: validator: continue to validate date attribute when present…
Browse files Browse the repository at this point in the history
…, even for snapshot releases
  • Loading branch information
jayaddison committed Aug 20, 2024
1 parent 1442ad7 commit 1ad7c73
Showing 1 changed file with 17 additions and 19 deletions.
36 changes: 17 additions & 19 deletions src/as-validator.c
Original file line number Diff line number Diff line change
Expand Up @@ -2444,26 +2444,24 @@ as_validator_check_release (AsValidator *validator, xmlNode *node, AsFormatStyle
g_free (prop);
}

if (rel_kind != AS_RELEASE_KIND_SNAPSHOT) {
/* validate date strings */
prop = as_xml_get_prop_value (node, "date");
if (prop != NULL) {
as_validator_validate_iso8601_complete_date (validator, node, prop);
g_free (prop);
/* validate date strings */
prop = as_xml_get_prop_value (node, "date");
if (prop != NULL) {
as_validator_validate_iso8601_complete_date (validator, node, prop);
g_free (prop);
} else if (rel_kind != AS_RELEASE_KIND_SNAPSHOT) {
g_autofree gchar *timestamp = as_xml_get_prop_value (node, "timestamp");
if (timestamp == NULL) {
/* Neither timestamp, nor date property exists */
as_validator_add_issue (validator, node, "release-time-missing", "date");
} else {
g_autofree gchar *timestamp = as_xml_get_prop_value (node, "timestamp");
if (timestamp == NULL) {
/* Neither timestamp, nor date property exists */
as_validator_add_issue (validator, node, "release-time-missing", "date");
} else {
/* check if the timestamp is both a number and higher than 3000. The 3000 is used to check that it is not a year */
if (!as_str_verify_integer (timestamp, 3000, G_MAXINT64))
as_validator_add_issue (validator,
node,
"release-timestamp-invalid",
"%s",
timestamp);
}
/* check if the timestamp is both a number and higher than 3000. The 3000 is used to check that it is not a year */
if (!as_str_verify_integer (timestamp, 3000, G_MAXINT64))
as_validator_add_issue (validator,
node,
"release-timestamp-invalid",
"%s",
timestamp);
}
}

Expand Down

0 comments on commit 1ad7c73

Please sign in to comment.