Do not cast bytes to strs
This commit is contained in:
1 parent
0e038cbb18
commit
4f97d95de3
1 file changed
+3
-2
+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