11import React , { useState , useEffect , useMemo } from 'react'
2- import { Form , Input , Modal } from 'antd'
2+ import { Form , Input , message , Modal } from 'antd'
33import { EllipsisOutlined } from '@ant-design/icons'
44
55import {
@@ -39,6 +39,11 @@ const CreateModal = ({ show, onClose }: CreateModalProps) => {
3939
4040 // 下载开始
4141 const handleOk = async ( ) => {
42+ if ( ! / ^ ( h t t p ( s ? ) | f t p | b l o b ) : | d a t a : .* ; b a s e 6 4 / . test ( formData . url ) ) {
43+ message . error ( '下载地址只支持 http、ftp、base64、blob 协议' )
44+ return
45+ }
46+
4247 const item = await newDownloadFile ( formData )
4348 if ( ! item ) return
4449
@@ -104,6 +109,7 @@ const CreateModal = ({ show, onClose }: CreateModalProps) => {
104109 < Form labelCol = { { span : 3 } } >
105110 < Form . Item label = '地址:' >
106111 < Input
112+ placeholder = '支持 http、ftp、base64、blob 协议'
107113 value = { formData ?. url }
108114 onChange = { e => handleFormChange ( 'url' , e . target . value ) }
109115 onFocus = { handleFocus }
@@ -112,7 +118,7 @@ const CreateModal = ({ show, onClose }: CreateModalProps) => {
112118 < Form . Item label = '文件名:' >
113119 < Input
114120 value = { formData ?. fileName }
115- onChange = { e => handleFormChange ( 'filename ' , e . target . value ) }
121+ onChange = { e => handleFormChange ( 'fileName ' , e . target . value ) }
116122 onFocus = { handleFocus }
117123 />
118124 </ Form . Item >
0 commit comments