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