Skip to content

Commit

Permalink
automatically truncate longer cat strings
Browse files Browse the repository at this point in the history
  • Loading branch information
BLooperZ committed May 29, 2023
1 parent 8cce195 commit 3ed6377
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions boozook/codex/cat.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,11 @@ def compose(
continue
enc = enc.replace(b'~', b'\0')
towrite = enc.ljust(LINE_SIZE, b'\0')
if sum(towrite[40:]) > 0:
raise ValueError(
'Non-null characters after 40 characters limit',
)
towrite = towrite[:40]
assert len(towrite) == LINE_SIZE, len(towrite)
output.write(towrite)

Expand Down

0 comments on commit 3ed6377

Please sign in to comment.