mirror of
https://github.com/ArchiveBox/ArchiveBox.git
synced 2025-05-13 14:44:29 -04:00
fix log line view in admin data when bytes are not utf8
This commit is contained in:
parent
0cfcabf6f4
commit
7b85ba7fd8
1 changed files with 1 additions and 1 deletions
|
@ -403,7 +403,7 @@ def log_list_view(request: HttpRequest, **kwargs) -> TableContext:
|
||||||
f.seek(-1024, os.SEEK_END)
|
f.seek(-1024, os.SEEK_END)
|
||||||
except OSError:
|
except OSError:
|
||||||
f.seek(0)
|
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()]
|
non_empty_lines = [line for line in last_lines if line.strip()]
|
||||||
rows["Most Recent Lines"].append(non_empty_lines[-1])
|
rows["Most Recent Lines"].append(non_empty_lines[-1])
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue