fix: strip leading/trailing non-alphanumeric chars in _normalize_squadron_tag

The old regex [^A-Za-z0-9_-] whitelisted dashes and underscores, so
-DSPLA- and _APS_ passed through untouched. All downstream code that
reads team["squadron"] then saw the raw tag instead of the bare short
name, causing NULL clan_ids in player_games_hist/match_summary and
broken lookups throughout. Fixing at the source means every consumer
gets a clean name without individual patches.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
deploy
2026-05-29 18:24:25 +00:00
parent 74c56881fd
commit c0755ec243
+1 -1
View File
@@ -1224,7 +1224,7 @@ def transform_to_local_format(api_data: Dict[str, Any]) -> Optional[Dict[str, An
loser_winged = str(replay.get("loser") or "")
def _normalize_squadron_tag(raw: str) -> str:
cleaned = re.sub(r"[^A-Za-z0-9_-]", "", raw or "")
cleaned = re.sub(r'^[^A-Za-z0-9]+|[^A-Za-z0-9]+$', '', raw or "")
return cleaned or (raw or "").strip()
winner_squadron = _normalize_squadron_tag(winner_winged)