Skip to content
This repository was archived by the owner on Aug 7, 2025. It is now read-only.

Commit 4b5b57e

Browse files
clsullivalexjch
authored andcommitted
model.py: save payload as text instead of encoded UTF-8
The website does not decode text. Without this change using the Record initializer directly, such as in Record.create, would result in payload text not being human readable. Signed-off-by: California Sullivan <[email protected]>
1 parent 33afa54 commit 4b5b57e

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

shared/model.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -122,11 +122,8 @@ def __init__(self, machine_id, host_type, severity, classification, build, archi
122122
self.bios_version = bios_version
123123
self.cpu_model = cpu_model
124124
self.event_id = event_id
125+
self.payload = payload
125126

126-
try:
127-
self.payload = payload.encode('utf-8')
128-
except UnicodeError:
129-
self.payload = payload.encode('latin-1')
130127

131128
def __repr__(self):
132129
return "<Record(id='{}', class='{}', build='{}', created='{}')>".format(self.id, self.classification, self.build, strftime("%a, %d %b %Y %H:%M:%S", localtime(self.timestamp_client)))

0 commit comments

Comments
 (0)