Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion app/api/rest_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@ def __init__(self, services):
asyncio.get_event_loop().create_task(AdvancedPack(services).enable())

async def enable(self):
self.app_svc.application.router.add_static('/assets', 'plugins/magma/dist/assets/', append_version=True)
# check if plugin path is present
if os.path.exists("plugins/magma/dist/assets") and (len(os.listdir("plugins/magma/dist/assets")) > 0):
self.app_svc.application.router.add_static('/assets', 'plugins/magma/dist/assets/', append_version=True)
# TODO: only serve static files in legacy plugin mode
self.app_svc.application.router.add_static('/gui', 'static/', append_version=True)
# unauthorized GUI endpoints
Expand Down
2 changes: 2 additions & 0 deletions tests/web_server/test_core_endpoints.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ async def sample_agent(aiohttp_client):


async def test_home(aiohttp_client):
if not (len(os.listdir("plugins/magma/dist/assets")) > 0):
pytest.xfail("Magma plugin not present, expecting failure")
resp = await aiohttp_client.get('/')
assert resp.status == HTTPStatus.OK
assert resp.content_type == 'text/html'
Expand Down