Do not cast bytes to strs
This commit is contained in:
parent
0e038cbb18
commit
4f97d95de3
|
|
@ -343,7 +343,8 @@ class TextFilePointer(BinaryFilePointer):
|
||||||
extension: str = ".txt"
|
extension: str = ".txt"
|
||||||
|
|
||||||
def prepare(self, data: value_type):
|
def prepare(self, data: value_type):
|
||||||
if data and not isinstance(data, bytes):
|
if isinstance(data, bytes):
|
||||||
|
return data
|
||||||
return str(data).encode()
|
return str(data).encode()
|
||||||
|
|
||||||
def deserialize(self, value: str, db: TinyDB, recurse: bool = True) -> value_type:
|
def deserialize(self, value: str, db: TinyDB, recurse: bool = True) -> value_type:
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user