Skip to content

Commit

Permalink
Don't crash on invalid JSON in page_config (#1403) (#1404)
Browse files Browse the repository at this point in the history
  • Loading branch information
holzman authored Mar 12, 2024
1 parent df27810 commit f26c1a0
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion jupyter_server/config_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,10 @@ def get(self, section_name: str, include_root: bool = True) -> dict[str, t.Any]:
for path in paths:
if os.path.isfile(path):
with open(path, encoding="utf-8") as f:
recursive_update(data, json.load(f))
try:
recursive_update(data, json.load(f))
except json.decoder.JSONDecodeError:
self.log.warn("Invalid JSON in %s, skipping", path)
return data

def set(self, section_name: str, data: t.Any) -> None:
Expand Down

0 comments on commit f26c1a0

Please sign in to comment.