fix: upload custom file extension (#10801)

This commit is contained in:
zxhlyh
2024-11-18 15:57:32 +08:00
committed by GitHub
parent 538a5df9d5
commit 9861279395
5 changed files with 11 additions and 12 deletions

View File

@@ -82,8 +82,6 @@ const FileUploadSetting: FC<Props> = ({
const handleCustomFileTypesChange = useCallback((customFileTypes: string[]) => {
const newPayload = produce(payload, (draft) => {
draft.allowed_file_extensions = customFileTypes.map((v) => {
if (v.startsWith('.')) // Not start with dot
return v.slice(1)
return v
})
})
@@ -118,7 +116,7 @@ const FileUploadSetting: FC<Props> = ({
type={SupportUploadFileTypes.custom}
selected={allowed_file_types.includes(SupportUploadFileTypes.custom)}
onToggle={handleSupportFileTypeChange}
customFileTypes={allowed_file_extensions?.map(item => `.${item}`)}
customFileTypes={allowed_file_extensions}
onCustomFileTypesChange={handleCustomFileTypesChange}
/>
</div>