mirror of
https://github.com/f-droid/fdroidserver.git
synced 2025-11-05 06:50:29 +03:00
update: handle large, corrupt, or inaccessible fastlane/triple-t files
```
Traceback (most recent call last):
File "../fdroid", line 22, in <module>
fdroidserver.__main__.main()
File "/var/lib/jenkins/userContent/reproducible/reproducible_fdroid_build_apps/fdroidserver/__main__.py", line 227, in main
raise e
File "/var/lib/jenkins/userContent/reproducible/reproducible_fdroid_build_apps/fdroidserver/__main__.py", line 208, in main
mod.main()
File "/var/lib/jenkins/userContent/reproducible/reproducible_fdroid_build_apps/fdroidserver/update.py", line 2340, in main
repoapps = prepare_apps(apps, apks, repodirs[0])
File "/var/lib/jenkins/userContent/reproducible/reproducible_fdroid_build_apps/fdroidserver/update.py", line 2176, in prepare_apps
copy_triple_t_store_metadata(apps_with_packages)
File "/var/lib/jenkins/userContent/reproducible/reproducible_fdroid_build_apps/fdroidserver/update.py", line 1076, in copy_triple_t_store_metadata
_set_author_entry(app, 'authorWebSite', os.path.join(root, f))
File "/var/lib/jenkins/userContent/reproducible/reproducible_fdroid_build_apps/fdroidserver/update.py", line 784, in _set_author_entry
with open(f, errors='replace') as fp:
FileNotFoundError: [Errno 2] No such file or directory: 'build/player.efis.cfd/pfd/src/main/play/contact-website.txt'
```
This commit is contained in:
parent
14e9bffedb
commit
525dcb8f98
2 changed files with 100 additions and 14 deletions
|
|
@ -768,23 +768,41 @@ def _get_localized_dict(app, locale):
|
|||
|
||||
|
||||
def _set_localized_text_entry(app, locale, key, f):
|
||||
limit = config['char_limits'][key]
|
||||
localized = _get_localized_dict(app, locale)
|
||||
with open(f, errors='replace') as fp:
|
||||
text = fp.read()[:limit]
|
||||
if len(text) > 0:
|
||||
if key in ('name', 'summary', 'video'): # hardcoded as a single line
|
||||
localized[key] = text.strip('\n')
|
||||
else:
|
||||
localized[key] = text
|
||||
"""Read a fastlane/triple-t metadata file and add an entry to the app
|
||||
|
||||
This reads more than the limit, in case there is leading or
|
||||
trailing whitespace to be stripped
|
||||
|
||||
"""
|
||||
try:
|
||||
limit = config['char_limits'][key]
|
||||
localized = _get_localized_dict(app, locale)
|
||||
with open(f, errors='replace') as fp:
|
||||
text = fp.read(limit * 2)
|
||||
if len(text) > 0:
|
||||
if key in ('name', 'summary', 'video'): # hardcoded as a single line
|
||||
localized[key] = text.strip('\n')[:limit]
|
||||
else:
|
||||
localized[key] = text[:limit]
|
||||
except Exception as e:
|
||||
logging.error(_('{path}: {error}').format(path=f, error=str(e)))
|
||||
|
||||
|
||||
def _set_author_entry(app, key, f):
|
||||
limit = config['char_limits']['author']
|
||||
with open(f, errors='replace') as fp:
|
||||
text = fp.read()[:limit]
|
||||
if len(text) > 0:
|
||||
app[key] = text.strip()
|
||||
"""read a fastlane/triple-t author file and add the entry to the app
|
||||
|
||||
This reads more than the limit, in case there is leading or
|
||||
trailing whitespace to be stripped
|
||||
|
||||
"""
|
||||
try:
|
||||
limit = config['char_limits']['author']
|
||||
with open(f, errors='replace') as fp:
|
||||
text = fp.read(limit * 2)
|
||||
if len(text) > 0:
|
||||
app[key] = text.strip()[:limit]
|
||||
except Exception as e:
|
||||
logging.error(_('{path}: {error}').format(path=f, error=str(e)))
|
||||
|
||||
|
||||
def _strip_and_copy_image(in_file, outpath):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue