mirror of
https://github.com/PaiGramTeam/MibooGram.git
synced 2024-11-22 15:37:21 +00:00
🎨 Filter empty strings in parse cookies
This commit is contained in:
parent
cf22949a81
commit
a4d7593ab0
@ -264,12 +264,13 @@ class SetUserCookies(Plugin.Conversation, BasePlugin.Conversation):
|
|||||||
# cookie str to dict
|
# cookie str to dict
|
||||||
wrapped = (
|
wrapped = (
|
||||||
ArkoWrapper(message.text.split(";"))
|
ArkoWrapper(message.text.split(";"))
|
||||||
|
.filter(lambda x: x != "")
|
||||||
.map(lambda x: x.strip())
|
.map(lambda x: x.strip())
|
||||||
.map(lambda x: ((y := x.split("="))[0], y[1]))
|
.map(lambda x: ((y := x.split("="))[0], y[1]))
|
||||||
)
|
)
|
||||||
cookie = {x[0]: x[1] for x in wrapped}
|
cookie = {x[0]: x[1] for x in wrapped}
|
||||||
cookies = self.parse_cookie(cookie)
|
cookies = self.parse_cookie(cookie)
|
||||||
except (AttributeError, ValueError) as exc:
|
except (AttributeError, ValueError, IndexError) as exc:
|
||||||
logger.info("用户 %s[%s] Cookies解析出现错误\ntext:%s", user.full_name, user.id, message.text)
|
logger.info("用户 %s[%s] Cookies解析出现错误\ntext:%s", user.full_name, user.id, message.text)
|
||||||
logger.debug("解析Cookies出现错误", exc_info=exc)
|
logger.debug("解析Cookies出现错误", exc_info=exc)
|
||||||
await message.reply_text("解析Cookies出现错误,请检查是否正确", reply_markup=ReplyKeyboardRemove())
|
await message.reply_text("解析Cookies出现错误,请检查是否正确", reply_markup=ReplyKeyboardRemove())
|
||||||
|
Loading…
Reference in New Issue
Block a user