fix: Prevent locals() from polluting player PATCH data dict #4

Merged
cal merged 1 commits from fix/locals-pollution-patch-endpoint into main 2026-02-04 21:00:24 +00:00
2 changed files with 5 additions and 4 deletions

View File

@ -1 +1 @@
2.5.2
2.5.3

View File

@ -117,12 +117,13 @@ async def patch_player(
):
"""Patch a player (partial update)."""
# Build dict of provided fields
data = {}
# IMPORTANT: Capture locals() BEFORE creating data dict to avoid including 'data' itself
locals_dict = locals()
data = {}
for key, value in locals_dict.items():
if key not in ('player_id', 'token') and value is not None:
if key not in ('player_id', 'token', 'locals_dict') and value is not None:
data[key] = value
return PlayerService.patch_player(player_id, data, token)