修复文件格式解析的BUG
This commit is contained in:
parent
ecb0211345
commit
2e4508468f
10
file.go
10
file.go
@ -153,14 +153,8 @@ func (f *file) ReadAnyFileContent(filePath string, receiver any) error {
|
|||||||
var (
|
var (
|
||||||
parseFunc func(filePath string, receiver any) error
|
parseFunc func(filePath string, receiver any) error
|
||||||
)
|
)
|
||||||
filePathArr := strings.Split(filePath, "#@#")
|
|
||||||
fileExt := ""
|
fileExt := strings.TrimLeft(strings.ToLower(path.Ext(filePath)), ".")
|
||||||
filePath = filePathArr[0]
|
|
||||||
if len(filePathArr) == 2 && len(filePathArr[1]) > 0 {
|
|
||||||
fileExt = strings.ToLower(filePathArr[1])
|
|
||||||
} else {
|
|
||||||
fileExt = strings.ToLower(path.Ext(filePath))
|
|
||||||
}
|
|
||||||
switch fileExt {
|
switch fileExt {
|
||||||
case consts.FileTypeJson:
|
case consts.FileTypeJson:
|
||||||
parseFunc = f.ReadJSONContent
|
parseFunc = f.ReadJSONContent
|
||||||
|
Loading…
Reference in New Issue
Block a user