-
Notifications
You must be signed in to change notification settings - Fork 30
Open
Description
这些*_to_pic 的函数都会指定 html_to_pic 函数的 template_path 参数为某个文件 file://xxx
| template_path=f"file://{css_path or TEMPLATES_PATH}", |
而 html_to_pic 会让浏览器 goto 这个文件
nonebot-plugin-htmlrender/nonebot_plugin_htmlrender/data_source.py
Lines 211 to 215 in aabe392
| if "file:" not in template_path: | |
| raise Exception("template_path should be file:///path/to/template") | |
| async with get_new_page(device_scale_factor, **kwargs) as page: | |
| page.on("console", lambda msg: logger.debug(f"[Browser Console]: {msg.text}")) | |
| await page.goto(template_path) |
但是在浏览器和nb分离部署的时候(HTMLRENDER_CONNECT=xxx),浏览器那边可能不会存在这个路径,导致爆炸。
可以考虑
- 添加参数
goto_url="about:blank"默认跳转到goto_url - template_path默认值改为"about:blank",但是
html_to_pic里会检查url是否以"file://"开头,并且语义不是很明确(
发现这个的原因是 bison 想分离浏览器,但是测试炸掉了: failed test
Metadata
Metadata
Assignees
Labels
No labels