Skip to content

Commit f26c1a0

Browse files
authored
Don't crash on invalid JSON in page_config (#1403) (#1404)
1 parent df27810 commit f26c1a0

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

jupyter_server/config_manager.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,10 @@ def get(self, section_name: str, include_root: bool = True) -> dict[str, t.Any]:
103103
for path in paths:
104104
if os.path.isfile(path):
105105
with open(path, encoding="utf-8") as f:
106-
recursive_update(data, json.load(f))
106+
try:
107+
recursive_update(data, json.load(f))
108+
except json.decoder.JSONDecodeError:
109+
self.log.warn("Invalid JSON in %s, skipping", path)
107110
return data
108111

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

0 commit comments

Comments
 (0)