Skip to content

Commit

Permalink
Ignore pageconfig file if JSON is invalid
Browse files Browse the repository at this point in the history
  • Loading branch information
holzman committed Mar 11, 2024
1 parent 51ecf4f commit 1d3672f
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions jupyterlab_server/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,14 +127,17 @@ def get_page_config(
]
for path in config_paths:
if osp.exists(path):
data = load_config(path)
# Convert lists to dicts
for key in [disabled_key, "deferredExtensions"]:
if key in data:
data[key] = {key: True for key in data[key]}

recursive_update(page_config, data)
break
try:
data = load_config(path)
# Convert lists to dicts
for key in [disabled_key, "deferredExtensions"]:
if key in data:
data[key] = {key: True for key in data[key]}

recursive_update(page_config, data)
break
except json.decoder.JSONDecodeError:
logger.warning("%s is not valid JSON", path)

# Get the traitlets config
static_page_config = get_static_page_config(logger=logger, level="all")
Expand Down

0 comments on commit 1d3672f

Please sign in to comment.