Skip to content

A Q&A platform software for teams at any scales. Whether it's a community forum, help center, or knowledge management platform, you can always count on Apache Answer.

fix: xss link

shuaid0fac4e7c104
diff --git a/ui/src/pages/Questions/Detail/components/Alert/index.tsx b/ui/src/pages/Questions/Detail/components/Alert/index.tsx
index 14973373..bee8ece2 100644
--- a/ui/src/pages/Questions/Detail/components/Alert/index.tsx
+++ b/ui/src/pages/Questions/Detail/components/Alert/index.tsx
@@ -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">
diff --git a/ui/src/pages/Review/components/FlagContent/index.tsx b/ui/src/pages/Review/components/FlagContent/index.tsx
index 43f3bbfc..f1d56032 100644
--- a/ui/src/pages/Review/components/FlagContent/index.tsx
+++ b/ui/src/pages/Review/components/FlagContent/index.tsx
@@ -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>
diff --git a/ui/src/pages/Users/Personal/components/UserInfo/index.tsx b/ui/src/pages/Users/Personal/components/UserInfo/index.tsx
index dee5662f..07cc20b0 100644
--- a/ui/src/pages/Users/Personal/components/UserInfo/index.tsx
+++ b/ui/src/pages/Users/Personal/components/UserInfo/index.tsx
@@ -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}`
}>