fix: 菜单按钮查询参数不预先 urlencode,避免前端双重编码

bricks_fetch 的 url_parse 会把 url 查询参数提取后 encodeURIComponent 再编码一次,
dspy 里若已 urlencode 则 title(emoji/中文)被双重编码成 %F0%9F... 明文。
改为直接拼原始值,由前端统一编码一次。
This commit is contained in:
yumoqing 2026-08-16 19:29:19 +08:00
parent 34f4c5b79c
commit 670e73d8e5

View File

@ -39,7 +39,9 @@ except Exception:
menus = []
# 3. 构建菜单按钮actiontype=urlwidget 打开通用弹窗 agent_menu_open控制弹窗大小
import urllib.parse as _urlparse
# 注意:这里不预先 urlencode 查询参数。前端 bricks_fetch 的 url_parse 会把 url 里的
# 查询参数提取后再 encodeURIComponent 编码一次,若此处已 urlencode 会导致双重编码
# title 的 emoji/中文会变成 %F0%9F... 明文显示)。
buttons = []
@ -60,8 +62,7 @@ for i, m in enumerate(menus):
continue
width = str(m.get("width", "85%") or "85%")
height = str(m.get("height", "80%") or "80%")
query = _urlparse.urlencode({"url": url, "title": label, "width": width, "height": height})
open_url = entire_url("/pipeline_core/api/agent_menu_open.dspy") + "?" + query
open_url = entire_url("/pipeline_core/api/agent_menu_open.dspy") + "?url=" + url + "&title=" + label + "&width=" + width + "&height=" + height
buttons.append({
"widgettype": "Button",
"options": {"label": label, "css": "small", "id": "menu_btn_%d" % i},