-
Notifications
You must be signed in to change notification settings - Fork 12
Open
Description
stream 模式的 FileBox 无法发送
@dataclass
class FileBoxOptionsStream(FileBoxOptionsBase):
"""
stream file-box options
"""
# TODO -> recheck the stream data type
stream: bytes = b''
type: FileBoxType = FileBoxType.Stream
而对应的
class FileBoxEncoder(json.JSONEncoder):
def default(self, obj):
if isinstance(obj, bytes):
return str(obj, encoding='utf-8')
return json.JSONEncoder.default(self, obj)
因为 stream 是二进制的,且不是 utf8 格式,所以这里转换会失败
ERROR:root:'utf-8' codec can't decode byte 0x89 in position 0: invalid start byte
所以我觉得 FileBoxEncoder 可以再改改。
我可以来提供 PR
Metadata
Metadata
Assignees
Labels
No labels