Closed toconnell closed 6 years ago
I added HTML-stripping to the normalize() call:
diff --git a/v2/api/models/survivors.py b/v2/api/models/survivors.py
index 3314c8a..507531b 100644
--- a/v2/api/models/survivors.py
+++ b/v2/api/models/survivors.py
@@ -538,6 +538,15 @@ class Survivor(Models.UserAsset):
self.convert_weapon_proficiency_type()
self.perform_save = True
+
+ #
+ # user asset normalization
+ #
+
+ if self.survivor['name'] != utils.html_stripper(self.survivor['name']):
+ self.survivor['name'] = utils.html_stripper(self.survivor['name'])
+ self.perform_Save = True
+
It's worth the performance hit, I think.
So, what's really happening here is that we're trying to compose a UTF-8 string for the Event Log and we've got these upper ASCII elements and the whole thing is bombing out.
The good news is that the Survivor still gets made, but the bad news is that the API call comes back as a 500, and the user doesn't SEE the survivor in the webapp.
I think the fix is going to be to bite the bullet and wrap semantic logging in a wrapper that lets it fail gracefully (which is going to suck, but I don't want to rack up a bunch of debt here playing with string normalization, encoding, etc.).
Alright, _logevent() is wrapped, and errors dump to error.log after an alert email is sent (quietly) in the background. This will go out in the Timeline release.
From the auto-alert emails:
The offending survivor's name appears to be
Ñordel<br>
(not sure why the HTML stripper isn't clobbering that line break: check that out too).