mirror of https://gitee.com/answerdev/answer.git
fix(#993): add character check for tag sulg name
This commit is contained in:
parent
6ad3aa3396
commit
e304341fd0
|
@ -100,15 +100,6 @@ const QuestionList: FC<Props> = ({ source }) => {
|
|||
}
|
||||
const { data: listData, isLoading } = useQuestionList(reqParams);
|
||||
const count = listData?.count || 0;
|
||||
// const onOrderChange = (evt, order) => {
|
||||
// evt.preventDefault();
|
||||
// if (order === curOrder) {
|
||||
// return;
|
||||
// }
|
||||
// urlSearchParams.set('page', '1');
|
||||
// urlSearchParams.set('order', order);
|
||||
// setUrlSearchParams(urlSearchParams);
|
||||
// };
|
||||
|
||||
return (
|
||||
<div>
|
||||
|
|
|
@ -56,7 +56,7 @@ const useTagModal = (props: IProps = {}) => {
|
|||
} else if (displayName.value.length > MAX_LENGTH) {
|
||||
bol = false;
|
||||
formData.displayName = {
|
||||
value: '',
|
||||
value: displayName.value,
|
||||
isInvalid: true,
|
||||
errorMsg: t('form.fields.display_name.msg.range'),
|
||||
};
|
||||
|
@ -67,6 +67,7 @@ const useTagModal = (props: IProps = {}) => {
|
|||
errorMsg: '',
|
||||
};
|
||||
}
|
||||
|
||||
if (!slugName.value) {
|
||||
bol = false;
|
||||
formData.slugName = {
|
||||
|
@ -77,10 +78,17 @@ const useTagModal = (props: IProps = {}) => {
|
|||
} else if (slugName.value.length > MAX_LENGTH) {
|
||||
bol = false;
|
||||
formData.slugName = {
|
||||
value: '',
|
||||
value: slugName.value,
|
||||
isInvalid: true,
|
||||
errorMsg: t('form.fields.slug_name.msg.range'),
|
||||
};
|
||||
} else if (/[^a-z0-9+#\-.]/.test(slugName.value)) {
|
||||
bol = false;
|
||||
formData.slugName = {
|
||||
value: slugName.value,
|
||||
isInvalid: true,
|
||||
errorMsg: t('form.fields.slug_name.msg.character'),
|
||||
};
|
||||
} else {
|
||||
formData.slugName = {
|
||||
value: slugName.value,
|
||||
|
|
|
@ -221,7 +221,8 @@
|
|||
"description": "Spaces are not allowed, please use '-' instead.",
|
||||
"msg": {
|
||||
"empty": "Please enter a name for the tag.",
|
||||
"range": "URL slug up to 35 characters"
|
||||
"range": "URL slug up to 35 characters",
|
||||
"character": "must use the character set a-z 0-9 + # - ."
|
||||
}
|
||||
},
|
||||
"description": {
|
||||
|
|
Loading…
Reference in New Issue