fix: xss link

This commit is contained in:
shuai
2024-03-21 11:31:34 +08:00
parent e7fb619291
commit d0fac4e7c1
3 changed files with 5 additions and 3 deletions
@@ -32,7 +32,7 @@ const Index: FC<Props> = ({ data }) => {
<Alert className="mb-4" variant={data.level}>
{data.level === 'info' ? (
<div>
{data.msg.indexOf('http') > -1 ? (
{data.msg.startsWith('http') ? (
<p>
{data.description}{' '}
<a href={data.msg} className="alert-exist">
@@ -158,13 +158,15 @@ const Index: FC<IProps> = ({ refreshCount }) => {
reason?.content_type &&
(reason?.reason_type !== 60 ? (
<span> {flagItemData?.reason_content}</span>
) : (
) : flagItemData.reason_content?.startsWith('http') ? (
<a href={flagItemData.reason_content} className="alert-exist">
<strong>
{' '}
{t('show_exist', { keyPrefix: 'question_detail' })}
</strong>
</a>
) : (
<strong> {flagItemData?.reason_content}</strong>
))}
</p>
</Stack>
@@ -128,7 +128,7 @@ const Index: FC<Props> = ({ data }) => {
<a
className="link-secondary"
href={
data.website?.includes('http')
data.website?.startsWith('http')
? data.website
: `http://${data.website}`
}>