fix: normalise generated web panel PEM endings

This commit is contained in:
Jared Dohrman
2026-05-14 09:50:54 +10:00
parent 63d4ced2c1
commit 78bacc3dab
2 changed files with 8 additions and 2 deletions
+2
View File
@@ -16,6 +16,8 @@ cmake-*
compile_commands.json
.venv/
venv/
__pycache__/
*.py[cod]
platformio.local.ini
src/helpers/mqtt/generated/
site/
@@ -14,6 +14,10 @@ def render_pem_array(name, pem_text):
return f"static const char {name}[] =\n{joined};\n"
def ensure_trailing_newline(text):
return text if text.endswith("\n") else f"{text}\n"
project_dir = Path(env["PROJECT_DIR"])
header_path = project_dir / "src/helpers/mqtt/generated/WebPanelCert.h"
@@ -62,8 +66,8 @@ with tempfile.TemporaryDirectory() as tmp:
f"openssl failed while generating the web panel certificate header: {exc.stderr.strip()}"
) from exc
cert_pem = cert_path.read_text()
key_pem = key_path.read_text()
cert_pem = ensure_trailing_newline(cert_path.read_text())
key_pem = ensure_trailing_newline(key_path.read_text())
header_path.parent.mkdir(parents=True, exist_ok=True)
header_path.write_text(