mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
apps: don't miserably crash when failing to read .md file such as DESCRIPTION.md
This commit is contained in:
parent
97b69e7c69
commit
58ac633d80
1 changed files with 17 additions and 3 deletions
20
src/app.py
20
src/app.py
|
@ -2088,7 +2088,12 @@ def _parse_app_doc_and_notifications(path):
|
||||||
|
|
||||||
if pagename not in doc:
|
if pagename not in doc:
|
||||||
doc[pagename] = {}
|
doc[pagename] = {}
|
||||||
doc[pagename][lang] = read_file(filepath).strip()
|
|
||||||
|
try:
|
||||||
|
doc[pagename][lang] = read_file(filepath).strip()
|
||||||
|
except Exception as e:
|
||||||
|
logger.error(e)
|
||||||
|
continue
|
||||||
|
|
||||||
notifications = {}
|
notifications = {}
|
||||||
|
|
||||||
|
@ -2102,7 +2107,11 @@ def _parse_app_doc_and_notifications(path):
|
||||||
lang = m.groups()[0].strip("_") if m.groups()[0] else "en"
|
lang = m.groups()[0].strip("_") if m.groups()[0] else "en"
|
||||||
if pagename not in notifications[step]:
|
if pagename not in notifications[step]:
|
||||||
notifications[step][pagename] = {}
|
notifications[step][pagename] = {}
|
||||||
notifications[step][pagename][lang] = read_file(filepath).strip()
|
try:
|
||||||
|
notifications[step][pagename][lang] = read_file(filepath).strip()
|
||||||
|
except Exception as e:
|
||||||
|
logger.error(e)
|
||||||
|
continue
|
||||||
|
|
||||||
for filepath in glob.glob(os.path.join(path, "doc", f"{step}.d") + "/*.md"):
|
for filepath in glob.glob(os.path.join(path, "doc", f"{step}.d") + "/*.md"):
|
||||||
m = re.match(
|
m = re.match(
|
||||||
|
@ -2114,7 +2123,12 @@ def _parse_app_doc_and_notifications(path):
|
||||||
lang = lang.strip("_") if lang else "en"
|
lang = lang.strip("_") if lang else "en"
|
||||||
if pagename not in notifications[step]:
|
if pagename not in notifications[step]:
|
||||||
notifications[step][pagename] = {}
|
notifications[step][pagename] = {}
|
||||||
notifications[step][pagename][lang] = read_file(filepath).strip()
|
|
||||||
|
try:
|
||||||
|
notifications[step][pagename][lang] = read_file(filepath).strip()
|
||||||
|
except Exception as e:
|
||||||
|
logger.error(e)
|
||||||
|
continue
|
||||||
|
|
||||||
return doc, notifications
|
return doc, notifications
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue