Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Question]导出评论数据 artrans 文件内容 <> 会被转义为 \u003c \u003e #1063

Open
ehnap opened this issue Feb 24, 2025 · 0 comments

Comments

@ehnap
Copy link

ehnap commented Feb 24, 2025

版本号:2.9.1
Docker 部署

问题如标题,不是很确定这算不算一个问题,不影响功能。
两次导出的行为不一致,而且被转义之后,在某些实现不太鲁棒的 json 编辑器可能会认为 json 不合法。

复现方式:

  1. 构造一个站点,然后在页面按正常方式增加一些评论,评论中要带图片,且要以图片开头
  2. 导出评论数据 artrans 文件,这个时候得到的文件内容 json 是合法的 <> 没有被转义
  3. 将此文件随便改点内容(我自己使用的路径,估计不执行也不会影响复现),在后台 导入
  4. 在管理后台删除随便几条评论(我自己使用的路径,估计不执行也不会影响复现),在后台 导出
  5. 此时得到的 artrans 文件会发现 < 被转义成了 \u003c,> 被转义成了 \u003e

得到的 json 示例

{"id":"4","rid":"3","content":"\u003cimg src=\"https://cdn.jsdelivr.net/gh/eryajf/emotion_generate/dist/aru/image/003.gif\" atk-emoticon=\"aru-003\"\u003e","ua":"Mozilla/5.0 (Windows NT 11.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36","ip":"192.168.0.1","is_collapsed":"false","is_pending":"false","is_pinned":"false","vote_up":"0","vote_down":"0","created_at":"2024-12-01 08:07:26 +0800","updated_at":"2024-12-03 15:38:18 +0800","nick":"xxx","email":"[email protected]","link":"","badge_name":"管理员","badge_color":"#0083FF","page_key":"/posts/%E5%B9%B4%E5%BA%A6%E6%8A%A5%E5%91%8A/xxxxx.html","page_title":"2023xxxxx","page_admin_only":"false","site_name":"xxx","site_urls":"https://xxx.xxx.com"}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant