Merge pull request 'fix: Prevent locals() from polluting player PATCH data dict' (#4) from fix/locals-pollution-patch-endpoint into main
All checks were successful
Build Docker Image / build (push) Successful in 2m45s
All checks were successful
Build Docker Image / build (push) Successful in 2m45s
Reviewed-on: #4
This commit is contained in:
commit
ffcf0611b7
@ -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)
|
||||
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user