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

fix: unexpected escape #26

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open

fix: unexpected escape #26

wants to merge 3 commits into from

Conversation

Seidko
Copy link
Member

@Seidko Seidko commented May 31, 2023

概述

try to fix #24

也许这并不是一个很好的办法,但如果用其他的方法的话可能会带来更多的工作,我想这么做应该可以解决一部分问题。

如果愿意用更好的办法解决的话,可以在下面提出意见并关闭此 pr

Copy link
Member

@shigma shigma left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这样改应该是不行的,因为可能有 &lt;<span> 这样的情况,加了 unescape 会出错。

建议专门对 style 标签做处理。但这似乎也有点难。一种简单的办法是把 style 类似 head 也单独提取出来,然后插进结果的 head.join 后面。

@Seidko
Copy link
Member Author

Seidko commented Jun 1, 2023

在进行转义的时候 &lt; 应该是会被转义成 &amp;lt; 的吧?

@shigma
Copy link
Member

shigma commented Jun 1, 2023

在进行转义的时候 &lt; 应该是会被转义成 &amp;lt; 的吧?

你现在的行为是对一个合法的 HTML 做了反转义,我怀疑会出问题,但暂时提不出反例。可能需要其他人来看看,你可以 cc 一些组织内成员来 review。

@Seidko
Copy link
Member Author

Seidko commented Jun 3, 2023

你现在的行为是对一个合法的 HTML 做了反转义,我怀疑会出问题,但暂时提不出反例。可能需要其他人来看看,你可以 cc 一些组织内成员来 review。

好,我现在暂时也没想到哪些地方会导致问题。cc @MaikoTan

@MaikoTan
Copy link
Member

MaikoTan commented Jun 7, 2023

I think it would be better to handle stylesheet independently, rather than unescape everything.

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

Successfully merging this pull request may close these issues.

bug: 样式(字符串)传入 puppeteer 以后被转义了
3 participants