This is an automated email from the ASF dual-hosted git repository. linkinstar pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/incubator-answer.git
commit 4e792ea460d0811072b84ca0a3a6de0c04623009 Author: shuai <[email protected]> AuthorDate: Fri Nov 22 12:42:05 2024 +0800 fix: length error --- ui/src/components/Editor/ToolBars/file.tsx | 2 +- ui/src/pages/Admin/Write/index.tsx | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/ui/src/components/Editor/ToolBars/file.tsx b/ui/src/components/Editor/ToolBars/file.tsx index 869d1dc6..15238379 100644 --- a/ui/src/components/Editor/ToolBars/file.tsx +++ b/ui/src/components/Editor/ToolBars/file.tsx @@ -113,7 +113,7 @@ const Image = ({ editorInstance }) => { }); }; - if (!authorized_attachment_extensions.length) { + if (!authorized_attachment_extensions?.length) { return null; } diff --git a/ui/src/pages/Admin/Write/index.tsx b/ui/src/pages/Admin/Write/index.tsx index d82f5aa0..91e41493 100644 --- a/ui/src/pages/Admin/Write/index.tsx +++ b/ui/src/pages/Admin/Write/index.tsx @@ -140,13 +140,13 @@ const Index: FC = () => { max_attachment_size: Number(formData.max_attachment_size.value), max_image_megapixel: Number(formData.max_image_megapixel.value), authorized_image_extensions: - formData.authorized_image_extensions.value.length > 0 + formData.authorized_image_extensions.value?.length > 0 ? formData.authorized_image_extensions.value .split(',') ?.map((item) => item.trim().toLowerCase()) : [], authorized_attachment_extensions: - formData.authorized_attachment_extensions.value.length > 0 + formData.authorized_attachment_extensions.value?.length > 0 ? formData.authorized_attachment_extensions.value .split(',') ?.map((item) => item.trim().toLowerCase())
