fix: crash when an ext doesn't have static files

This commit is contained in:
Stefan Stammberger 2021-09-28 21:10:51 +02:00
parent ca5ee4ed4f
commit 8c5989d465
No known key found for this signature in database
GPG Key ID: 645FA807E935D9D5

View File

@ -96,9 +96,10 @@ def register_routes(app: FastAPI) -> None:
ext_module = importlib.import_module(f"lnbits.extensions.{ext.code}")
ext_route = getattr(ext_module, f"{ext.code}_ext")
ext_statics = getattr(ext_module, f"{ext.code}_static_files")
for s in ext_statics:
app.mount(s["path"], s["app"], s["name"])
if hasattr(ext_module, f"{ext.code}_static_files"):
ext_statics = getattr(ext_module, f"{ext.code}_static_files")
for s in ext_statics:
app.mount(s["path"], s["app"], s["name"])
app.include_router(ext_route)
except Exception as e: