mirror of
https://gitlab.com/fdroid/fdroidserver.git
synced 2024-11-20 13:50:12 +01:00
update: strip newlines from name/summary/video entries
These entries are hardcoded as a single line in all the app stores, so newlines should be stripped to get the data simple to use. This is in contrast with the on-disk format for Fastlane and Triple-T, which includes a newline in the title.txt and short_description.txt files. I think all files in those systems are normalized to end in a newline.
This commit is contained in:
parent
3b5e3a62a3
commit
6ce22bff56
@ -714,7 +714,10 @@ def _set_localized_text_entry(app, locale, key, f):
|
|||||||
with open(f, errors='replace') as fp:
|
with open(f, errors='replace') as fp:
|
||||||
text = fp.read()[:limit]
|
text = fp.read()[:limit]
|
||||||
if len(text) > 0:
|
if len(text) > 0:
|
||||||
localized[key] = text
|
if key in ('name', 'summary', 'video'): # hardcoded as a single line
|
||||||
|
localized[key] = text.strip('\n')
|
||||||
|
else:
|
||||||
|
localized[key] = text
|
||||||
|
|
||||||
|
|
||||||
def _set_author_entry(app, key, f):
|
def _set_author_entry(app, key, f):
|
||||||
|
@ -198,9 +198,9 @@
|
|||||||
"description": "full description\n",
|
"description": "full description\n",
|
||||||
"featureGraphic": "featureGraphic_GFRT5BovZsENGpJq1HqPODGWBRPWQsx25B95Ol5w_wU=.png",
|
"featureGraphic": "featureGraphic_GFRT5BovZsENGpJq1HqPODGWBRPWQsx25B95Ol5w_wU=.png",
|
||||||
"icon": "icon_NJXNzMcyf-v9i5a1ElJi0j9X1LvllibCa48xXYPlOqQ=.png",
|
"icon": "icon_NJXNzMcyf-v9i5a1ElJi0j9X1LvllibCa48xXYPlOqQ=.png",
|
||||||
"name": "title\n",
|
"name": "title",
|
||||||
"summary": "short description\n",
|
"summary": "short description",
|
||||||
"video": "video\n"
|
"video": "video"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -114,9 +114,9 @@ class UpdateTest(unittest.TestCase):
|
|||||||
if packageName == 'info.guardianproject.urzip':
|
if packageName == 'info.guardianproject.urzip':
|
||||||
self.assertEqual(7, len(app['localized']['en-US']))
|
self.assertEqual(7, len(app['localized']['en-US']))
|
||||||
self.assertEqual('full description\n', app['localized']['en-US']['description'])
|
self.assertEqual('full description\n', app['localized']['en-US']['description'])
|
||||||
self.assertEqual('title\n', app['localized']['en-US']['name'])
|
self.assertEqual('title', app['localized']['en-US']['name'])
|
||||||
self.assertEqual('short description\n', app['localized']['en-US']['summary'])
|
self.assertEqual('short description', app['localized']['en-US']['summary'])
|
||||||
self.assertEqual('video\n', app['localized']['en-US']['video'])
|
self.assertEqual('video', app['localized']['en-US']['video'])
|
||||||
self.assertEqual('icon_NJXNzMcyf-v9i5a1ElJi0j9X1LvllibCa48xXYPlOqQ=.png',
|
self.assertEqual('icon_NJXNzMcyf-v9i5a1ElJi0j9X1LvllibCa48xXYPlOqQ=.png',
|
||||||
app['localized']['en-US']['icon'])
|
app['localized']['en-US']['icon'])
|
||||||
self.assertEqual('featureGraphic_GFRT5BovZsENGpJq1HqPODGWBRPWQsx25B95Ol5w_wU=.png',
|
self.assertEqual('featureGraphic_GFRT5BovZsENGpJq1HqPODGWBRPWQsx25B95Ol5w_wU=.png',
|
||||||
@ -140,7 +140,7 @@ class UpdateTest(unittest.TestCase):
|
|||||||
elif packageName == 'com.nextcloud.client.dev':
|
elif packageName == 'com.nextcloud.client.dev':
|
||||||
self.assertEqual('Nextcloud Dev', app['localized']['en-US']['name'])
|
self.assertEqual('Nextcloud Dev', app['localized']['en-US']['name'])
|
||||||
self.assertEqual(586, len(app['localized']['en-US']['description']))
|
self.assertEqual(586, len(app['localized']['en-US']['description']))
|
||||||
self.assertEqual(79, len(app['localized']['en-US']['summary']))
|
self.assertEqual(78, len(app['localized']['en-US']['summary']))
|
||||||
elif packageName == 'eu.siacs.conversations':
|
elif packageName == 'eu.siacs.conversations':
|
||||||
self.assertEqual('Conversations', app['localized']['en-US']['name'])
|
self.assertEqual('Conversations', app['localized']['en-US']['name'])
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user