fix(gateway): add utf-8 encoding to dead target registry

This commit is contained in:
Rod Boev 2026-07-07 01:37:18 -04:00 committed by Teknium
parent 5b76ce169b
commit 09910bc3a5

View file

@ -67,7 +67,7 @@ class DeadTargetRegistry:
def _load(self) -> None:
try:
if self._path.exists():
raw = json.loads(self._path.read_text())
raw = json.loads(self._path.read_text(encoding="utf-8"))
if isinstance(raw, dict):
# Only keep well-shaped entries.
self._dead = {
@ -82,7 +82,7 @@ class DeadTargetRegistry:
try:
self._path.parent.mkdir(parents=True, exist_ok=True)
tmp = self._path.with_suffix(self._path.suffix + ".tmp")
tmp.write_text(json.dumps(self._dead, indent=2))
tmp.write_text(json.dumps(self._dead, indent=2), encoding="utf-8")
tmp.replace(self._path)
except OSError as exc:
# Best-effort: keep the in-memory state, don't break delivery.