Skip to content

Commit 1b68d85

Browse files
committed
fix: 暂时关闭二进制文件检测
1 parent 1c7a79f commit 1b68d85

1 file changed

Lines changed: 11 additions & 12 deletions

File tree

frontend/src/hooks/useCode.ts

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ import axios from 'axios'
44

55
import { HOST } from '@/utils/env'
66
import { LANG_MAP } from '@/utils/option'
7-
import { getEncodeValue, isBinaryContent } from '@/utils/file'
7+
import { getEncodeValue } from '@/utils/file'
88

9-
import { useOpenStore } from '@/store/open'
9+
// import { useOpenStore } from '@/store/open'
1010

1111
interface OptionModel {
1212
confirm: () => boolean
@@ -26,7 +26,7 @@ interface CodeModel {
2626
}
2727

2828
export default function useCode(option: OptionModel) {
29-
const open = useOpenStore()
29+
// const open = useOpenStore()
3030

3131
const code = reactive<CodeModel>({
3232
path: '',
@@ -49,21 +49,20 @@ export default function useCode(option: OptionModel) {
4949
responseType: 'blob',
5050
})
5151

52-
if (await isBinaryContent(data)) {
53-
option.onError('不支持二进制文件的编辑')
54-
open.removeHistory(path)
55-
return
56-
}
57-
58-
code.byte = headers['x-size'] ? Number(headers['x-size']) : undefined
59-
code.date = headers['x-update-date'] ? dayjs(headers['x-update-date']) : undefined
60-
6152
const info = await getEncodeValue(data)
6253

6354
code.blob = data
6455
code.path = path
6556
code.encode = info.encode
6657
code.org = code.value = info.value
58+
code.byte = headers['x-size'] ? Number(headers['x-size']) : undefined
59+
code.date = headers['x-update-date'] ? dayjs(headers['x-update-date']) : undefined
60+
61+
// if (await isBinaryContent(data)) {
62+
// option.onError('不支持二进制文件的编辑')
63+
// open.removeHistory(path)
64+
// return
65+
// }
6766

6867
const filename = path.split('/').pop() || ''
6968

0 commit comments

Comments
 (0)