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:
+1
-1
@@ -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 "")
|
loser_winged = str(replay.get("loser") or "")
|
||||||
|
|
||||||
def _normalize_squadron_tag(raw: str) -> str:
|
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()
|
return cleaned or (raw or "").strip()
|
||||||
|
|
||||||
winner_squadron = _normalize_squadron_tag(winner_winged)
|
winner_squadron = _normalize_squadron_tag(winner_winged)
|
||||||
|
|||||||
Reference in New Issue
Block a user