fix: _post_js拼接dict致TypeError500——所有带按钮弹窗路径全炸(staff_replied态无按钮分支掩盖了此bug),dict改json.dumps序列化
This commit is contained in:
parent
9c36ab38d2
commit
e613bc860f
@ -101,8 +101,15 @@ def _read_input_js(wid):
|
||||
|
||||
|
||||
def _post_js(url, body_expr):
|
||||
# body_expr 为 dict 时序列化为 JS 对象字面量(2026-09-10 修复:原实现直接
|
||||
# 字符串拼接 dict → TypeError 500,所有带按钮的弹窗路径全炸;此前 staff_replied
|
||||
# 态不进任何按钮分支才掩盖了此bug)。占位符 "cv_placeholder" 后续替换为 JS 变量 cv。
|
||||
if isinstance(body_expr, dict):
|
||||
body_js = _json.dumps(body_expr)
|
||||
else:
|
||||
body_js = str(body_expr)
|
||||
return ("var r=await fetch(" + _json.dumps(url) + ",{method:'POST',"
|
||||
"headers:{'Content-Type':'application/json'},body:JSON.stringify(" + body_expr + ")});"
|
||||
"headers:{'Content-Type':'application/json'},body:JSON.stringify(" + body_js + ")});"
|
||||
"var d=await r.json();" + _tail)
|
||||
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user