From 6eaa177b2f9a6100f0a4900e03589e09a5e7b932 Mon Sep 17 00:00:00 2001 From: iabhi4 Date: Thu, 5 Jun 2025 14:47:22 -0700 Subject: [PATCH] DOC: Validate versions.json before building docs #61573 --- web/pandas_web.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/web/pandas_web.py b/web/pandas_web.py index b3872b829c73a..27e09b5e7d6c6 100755 --- a/web/pandas_web.py +++ b/web/pandas_web.py @@ -441,6 +441,16 @@ def main( For ``.md`` and ``.html`` files, render them with the context before copying them. ``.md`` files are transformed to HTML. """ + # Sanity check: validate that versions.json is valid JSON + versions_path = os.path.join(source_path, "versions.json") + with open(versions_path, encoding="utf-8") as f: + try: + json.load(f) + except json.JSONDecodeError as e: + raise RuntimeError( + f"Invalid versions.json: {e}. Ensure it is valid JSON." + ) from e + config_fname = os.path.join(source_path, "config.yml") shutil.rmtree(target_path, ignore_errors=True)