Skip to content

Commit

Permalink
fix: touni() should recognize bytearray
Browse files Browse the repository at this point in the history
  • Loading branch information
defnull committed Nov 18, 2024
1 parent 821865d commit cefe133
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions bottle.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,9 +127,9 @@ def tob(s, enc='utf8'):


def touni(s, enc='utf8', err='strict'):
if isinstance(s, bytes):
return s.decode(enc, err)
return unicode("" if s is None else s)
if isinstance(s, (bytes, bytearray)):
return str(s, enc, err)
return "" if s is None else str(s)


def _stderr(*args):
Expand Down

0 comments on commit cefe133

Please sign in to comment.