fix log line view in admin data when bytes are not utf8

This commit is contained in:
Nick Sweeting 2024-09-26 02:41:45 -07:00
parent 0cfcabf6f4
commit 7b85ba7fd8
No known key found for this signature in database

View file

@ -403,7 +403,7 @@ def log_list_view(request: HttpRequest, **kwargs) -> TableContext:
f.seek(-1024, os.SEEK_END)
except OSError:
f.seek(0)
last_lines = f.read().decode().split("\n")
last_lines = f.read().decode('utf-8', errors='replace').split("\n")
non_empty_lines = [line for line in last_lines if line.strip()]
rows["Most Recent Lines"].append(non_empty_lines[-1])