Skip to content

Commit e27a3ad

Browse files
committed
bugfix: 修复处理base64 url 多替换了/而报错的bug
1 parent fd2a068 commit e27a3ad

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

astrbot/core/platform/sources/kook/kook_client.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -360,11 +360,9 @@ async def upload_asset(self, file_url: str | None) -> str:
360360
filename = file_url.split("/")[-1]
361361
return file_url
362362

363-
elif file_url.startswith("base64://"):
364-
if file_url.startswith("base64:///"):
365-
b64_str = file_url.removeprefix("base64:///")
366-
else:
367-
b64_str = file_url.removeprefix("base64://")
363+
elif file_url.startswith("base64:///"):
364+
# b64decode的时候得开头留一个'/'的, 不然会报错
365+
b64_str = file_url.removeprefix("base64://")
368366
bytes_data = base64.b64decode(b64_str)
369367

370368
elif file_url.startswith("file://"):

0 commit comments

Comments
 (0)