mirror of
https://git.mirrors.martin98.com/https://github.com/langgenius/dify.git
synced 2025-08-19 23:19:15 +08:00
fix: allow file extensions remove .
This commit is contained in:
parent
d933ebb845
commit
6c9c3faf78
@ -68,9 +68,9 @@ const FileUploadSetting: FC<Props> = ({
|
|||||||
const handleCustomFileTypesChange = useCallback((customFileTypes: string[]) => {
|
const handleCustomFileTypesChange = useCallback((customFileTypes: string[]) => {
|
||||||
const newPayload = produce(payload, (draft) => {
|
const newPayload = produce(payload, (draft) => {
|
||||||
draft.allowed_file_extensions = customFileTypes.map((v) => {
|
draft.allowed_file_extensions = customFileTypes.map((v) => {
|
||||||
if (v.startsWith('.'))
|
if (v.startsWith('.')) // Not start with dot
|
||||||
return v
|
return v.slice(1)
|
||||||
return `.${v}`
|
return v
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
onChange(newPayload)
|
onChange(newPayload)
|
||||||
@ -104,7 +104,7 @@ const FileUploadSetting: FC<Props> = ({
|
|||||||
type={SupportUploadFileTypes.custom}
|
type={SupportUploadFileTypes.custom}
|
||||||
selected={allowed_file_types.includes(SupportUploadFileTypes.custom)}
|
selected={allowed_file_types.includes(SupportUploadFileTypes.custom)}
|
||||||
onToggle={handleSupportFileTypeChange}
|
onToggle={handleSupportFileTypeChange}
|
||||||
customFileTypes={allowed_file_extensions}
|
customFileTypes={allowed_file_extensions?.map(item => `.${item}`)}
|
||||||
onCustomFileTypesChange={handleCustomFileTypesChange}
|
onCustomFileTypesChange={handleCustomFileTypesChange}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user