Skip to content

Commit

Permalink
fix: 免配置启动路径选择路径不限制后缀
Browse files Browse the repository at this point in the history
  • Loading branch information
song-xiao-lin committed Jul 25, 2024
1 parent 4d9c344 commit c441fb0
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -456,10 +456,6 @@ export const ConfigNetworkPage: React.FC<ConfigNetworkPageProp> = (props) => {
}
})
}, [])
const suffixFun = (file_name: string) => {
let file_index = file_name.lastIndexOf(".")
return file_name.slice(file_index, file_name.length)
}
const onSetChromePath = useMemoizedFn((value?: string) => {
setRemoteValue(RemoteGV.GlobalChromePath, JSON.stringify(value || chromePath))
})
Expand Down Expand Up @@ -771,17 +767,11 @@ export const ConfigNetworkPage: React.FC<ConfigNetworkPageProp> = (props) => {
onChange={(e) => setChromePath(e.target.value)}
/>
<Upload
accept={".exe"}
multiple={false}
maxCount={1}
showUploadList={false}
beforeUpload={(f) => {
const file_name = f.name
const suffix = suffixFun(file_name)
if (![".exe"].includes(suffix)) {
warn("上传文件格式错误,请重新上传")
return false
}
// @ts-ignore
const path: string = f?.path || ""
if (path.length > 0) {
Expand Down
10 changes: 0 additions & 10 deletions app/renderer/src/main/src/utils/ConfigSystemProxy.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -168,10 +168,6 @@ export const ConfigChromePath: React.FC<ConfigChromePathProp> = (props) => {
onClose()
})

const suffixFun = (file_name: string) => {
let file_index = file_name.lastIndexOf(".")
return file_name.slice(file_index, file_name.length)
}
return (
<YakitSpin spinning={loading}>
<div className={styles["config-system-proxy"]}>
Expand All @@ -191,17 +187,11 @@ export const ConfigChromePath: React.FC<ConfigChromePathProp> = (props) => {
onChange={(e) => setChromePath(e.target.value)}
/>
<Upload
accept={".exe"}
multiple={false}
maxCount={1}
showUploadList={false}
beforeUpload={(f) => {
const file_name = f.name
const suffix = suffixFun(file_name)
if (![".exe"].includes(suffix)) {
warn("上传文件格式错误,请重新上传")
return false
}
// @ts-ignore
const path: string = f?.path || ""
if (path.length > 0) {
Expand Down

0 comments on commit c441fb0

Please sign in to comment.