From 2e4508468f45ff59958176088a753f6267109b87 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=99=BD=E8=8C=B6=E6=B8=85=E6=AC=A2?= Date: Thu, 7 Nov 2024 18:16:41 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=96=87=E4=BB=B6=E6=A0=BC?= =?UTF-8?q?=E5=BC=8F=E8=A7=A3=E6=9E=90=E7=9A=84BUG?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- file.go | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/file.go b/file.go index f9366fa..e59d62f 100644 --- a/file.go +++ b/file.go @@ -153,14 +153,8 @@ func (f *file) ReadAnyFileContent(filePath string, receiver any) error { var ( parseFunc func(filePath string, receiver any) error ) - filePathArr := strings.Split(filePath, "#@#") - fileExt := "" - filePath = filePathArr[0] - if len(filePathArr) == 2 && len(filePathArr[1]) > 0 { - fileExt = strings.ToLower(filePathArr[1]) - } else { - fileExt = strings.ToLower(path.Ext(filePath)) - } + + fileExt := strings.TrimLeft(strings.ToLower(path.Ext(filePath)), ".") switch fileExt { case consts.FileTypeJson: parseFunc = f.ReadJSONContent