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

Dangerous property 'dangerouslySetInnerHTML' found #1142

Closed
aiden-leong opened this issue Mar 21, 2018 · 4 comments
Closed

Dangerous property 'dangerouslySetInnerHTML' found #1142

aiden-leong opened this issue Mar 21, 2018 · 4 comments

Comments

@aiden-leong
Copy link

src/components/Charts/ChartCard/index.js
14:48 warning Dangerous property 'dangerouslySetInnerHTML' found react/no-danger

@chenshuai2144
Copy link
Collaborator

@nikogu 为什么要这么写呢? 我发现了好几个

@nikogu
Copy link
Contributor

nikogu commented Mar 23, 2018

@chenshuai2144 需要展示特殊字符啊...这个是 warning 不是 error,就是开发者自己要注意,你如果用不到特殊字符,你就可以改成直接显示的方式。

https://github.com/ant-design/ant-design-pro/blob/master/src/routes/Dashboard/Analysis.js#L255
https://github.com/ant-design/ant-design-pro/blob/master/src/components/Charts/ChartCard/index.js#L14

@afc163
Copy link
Member

afc163 commented Mar 23, 2018

组件里最好不要用 dangerouslySetInnerHTML,有安全风险。

nikogu added a commit that referenced this issue Mar 23, 2018
@nikogu
Copy link
Contributor

nikogu commented Mar 23, 2018

倒是从来没遇到过什么安全问题,执行标签如 script 即使在 dangerouslySetInnerHTML 也并没有什么作用。

抽离出来,交给用户自己决定好了。

pkaq pushed a commit to pkaq/Eva-Pro that referenced this issue Mar 26, 2018
* fixed: ant-design#1142

* fix typo

* fix typo

* fix typo

* add missing fix
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

4 participants