From 521ff4fe1789472024ac11bdd308b7134311489e Mon Sep 17 00:00:00 2001 From: Jochen Sprickerhof Date: Sun, 10 Sep 2023 10:05:15 +0200 Subject: [PATCH] Add default locale for generated categories The client expects at least a name to be set. Regression of 2c566cf6. --- fdroidserver/index.py | 2 +- tests/repo/entry.json | 2 +- tests/repo/index-v2.json | 18 +++++++++++++++--- tests/update.TestCase | 6 +++--- 4 files changed, 20 insertions(+), 8 deletions(-) diff --git a/fdroidserver/index.py b/fdroidserver/index.py index bef83ff6..2f5bd50f 100644 --- a/fdroidserver/index.py +++ b/fdroidserver/index.py @@ -746,7 +746,7 @@ def make_v2(apps, packages, repodir, repodict, requestsdict, fdroid_signing_key_ # include definitions for "auto-defined" categories, e.g. just used in app metadata for category in sorted(categories_used_by_apps): if category not in output['repo'][CATEGORIES_CONFIG_NAME]: - output['repo'][CATEGORIES_CONFIG_NAME][category] = dict() + output['repo'][CATEGORIES_CONFIG_NAME][category] = {"name": {DEFAULT_LOCALE: category}} # do not include defined categories if no apps use them for category in list(output['repo'].get(CATEGORIES_CONFIG_NAME, list())): if category not in categories_used_by_apps: diff --git a/tests/repo/entry.json b/tests/repo/entry.json index 56249552..ae645055 100644 --- a/tests/repo/entry.json +++ b/tests/repo/entry.json @@ -3,7 +3,7 @@ "version": 20002, "index": { "name": "/index-v2.json", - "sha256": "5e3c0eaafd99d3518da2bb2bc7565b2ebcb17775a2f4ccc33b7336901ec71a6f", + "sha256": "72146bc3bbbfd49c4e23435ca8ba13d58673a83fa4634f7ce2ea465616860293", "size": 53283, "numPackages": 10 }, diff --git a/tests/repo/index-v2.json b/tests/repo/index-v2.json index d41b95b5..3bc7fcaa 100644 --- a/tests/repo/index-v2.json +++ b/tests/repo/index-v2.json @@ -534,9 +534,21 @@ "en-US": "System" } }, - "1": {}, - "2.0": {}, - "tests": {} + "1": { + "name": { + "en-US": "1" + } + }, + "2.0": { + "name": { + "en-US": "2.0" + } + }, + "tests": { + "name": { + "en-US": "tests" + } + } }, "requests": { "install": [ diff --git a/tests/update.TestCase b/tests/update.TestCase index ac9a6f5e..7b9d6720 100755 --- a/tests/update.TestCase +++ b/tests/update.TestCase @@ -1842,7 +1842,7 @@ class UpdateTest(unittest.TestCase): with open('repo/index-v2.json') as fp: index = json.load(fp) self.assertEqual( - {'Time': dict()}, + {'Time': {'name': {'en-US': 'Time'}}}, index['repo'][CATEGORIES_CONFIG_NAME], ) @@ -1867,7 +1867,7 @@ class UpdateTest(unittest.TestCase): with open('repo/index-v2.json') as fp: index = json.load(fp) self.assertEqual( - {'bar': dict(), 'foo': dict()}, + {'bar': {'name': {'en-US': 'bar'}}, 'foo': {'name': {'en-US': 'foo'}}}, index['repo'][CATEGORIES_CONFIG_NAME], ) @@ -1894,7 +1894,7 @@ class UpdateTest(unittest.TestCase): with open('repo/index-v2.json') as fp: index = json.load(fp) self.assertEqual( - {'System': {'name': {'en-US': 'System Apps'}}, 'Time': dict()}, + {'System': {'name': {'en-US': 'System Apps'}}, 'Time': {'name': {'en-US': 'Time'}}}, index['repo'][CATEGORIES_CONFIG_NAME], )