From 551fca21b3eb717e874af31aba24939b6e1501d2 Mon Sep 17 00:00:00 2001 From: Jochen Sprickerhof Date: Fri, 4 Nov 2022 19:18:31 +0100 Subject: [PATCH 1/2] lint: UpdateCheckData regex must match integers --- fdroidserver/lint.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/fdroidserver/lint.py b/fdroidserver/lint.py index 6e11c8a6..a052557e 100644 --- a/fdroidserver/lint.py +++ b/fdroidserver/lint.py @@ -218,6 +218,8 @@ regex_checks = { locale_pattern = re.compile(r"[a-z]{2,3}(-([A-Z][a-zA-Z]+|\d+|[a-z]+))*") +versioncode_check_pattern = re.compile(r"(\\d|\[(0-9|\\d)_?(a-fA-F)?])[+]") + def check_regexes(app): for f, checks in regex_checks.items(): @@ -261,6 +263,17 @@ def check_update_check_data_url(app): # noqa: D403 yield _('UpdateCheckData must use HTTPS URL: {url}').format(url=url) +def check_update_check_data_int(app): # noqa: D403 + """UpdateCheckData regex must match integers.""" + if app.UpdateCheckData: + urlcode, codeex, urlver, verex = app.UpdateCheckData.split('|') + # codeex can be empty as well + if codeex and not versioncode_check_pattern.search(codeex): + yield _( + f'UpdateCheckData must match the version code as integer (\\d or [0-9]): {codeex}' + ) + + def check_vercode_operation(app): if not app.VercodeOperation: return @@ -767,6 +780,7 @@ def main(): check_app_field_types, check_regexes, check_update_check_data_url, + check_update_check_data_int, check_vercode_operation, check_ucm_tags, check_char_limits, From dedce2f2368c374318ec951a3f951ccfa9545db1 Mon Sep 17 00:00:00 2001 From: Jochen Sprickerhof Date: Fri, 4 Nov 2022 19:48:21 +0100 Subject: [PATCH 2/2] lint: AUM with UCM: HTTP must have a pattern Closes: #1029 --- fdroidserver/lint.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/fdroidserver/lint.py b/fdroidserver/lint.py index a052557e..e8417510 100644 --- a/fdroidserver/lint.py +++ b/fdroidserver/lint.py @@ -690,6 +690,12 @@ def check_updates_expected(app): ) +def check_updates_ucm_http_aum_pattern(app): # noqa: D403 + """AutoUpdateMode with UpdateCheckMode: HTTP must have a pattern.""" + if app.UpdateCheckMode == "HTTP" and app.AutoUpdateMode == "Version": + yield _("AutoUpdateMode with UpdateCheckMode: HTTP must have a pattern.") + + def main(): global config, options @@ -798,6 +804,7 @@ def main(): check_license_tag, check_current_version_code, check_updates_expected, + check_updates_ucm_http_aum_pattern, ] for check_func in app_check_funcs: