Do not cast bytes to strs
This commit is contained in:
+3
-2
@@ -343,8 +343,9 @@ 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 str(data).encode()
|
return data
|
||||||
|
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:
|
||||||
if not value:
|
if not value:
|
||||||
|
|||||||
Reference in New Issue
Block a user