🐛 BytesIO cursor 可能不在开头

This commit is contained in:
jinser
2021-08-23 00:12:47 +08:00
committed by GitHub
parent 474fd10613
commit fff7d3bff6

View File

@ -89,7 +89,7 @@ class MessageSegment(BaseMessageSegment["Message"]):
proxy: bool = True,
timeout: Optional[int] = None) -> "MessageSegment":
if isinstance(file, BytesIO):
file = file.read()
file = file.getvalue()
if isinstance(file, bytes):
file = f"base64://{b64encode(file).decode()}"
elif isinstance(file, Path):