From 9853b15227045c40edbb05e73a7834b6e820ea88 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=91=E6=9E=AB=E5=8F=B6?= <454383818@qq.com> Date: Fri, 17 May 2024 13:26:02 +0800 Subject: [PATCH] fix-cfg-adaptfile-dogetfilepath --- os/gcfg/gcfg_adapter_file_path.go | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/os/gcfg/gcfg_adapter_file_path.go b/os/gcfg/gcfg_adapter_file_path.go index bbe11904d41..981695b2e2f 100644 --- a/os/gcfg/gcfg_adapter_file_path.go +++ b/os/gcfg/gcfg_adapter_file_path.go @@ -216,9 +216,9 @@ func (a *AdapterFile) doGetFilePath(fileName string) (filePath string) { // Searching local file system. if filePath == "" { // Absolute path. - if filePath = gfile.RealPath(fileName); filePath != "" && !gfile.IsDir(filePath) { + /*if filePath = gfile.RealPath(fileName); filePath != "" && !gfile.IsDir(filePath) { return - } + }*/ a.searchPaths.RLockFunc(func(array []string) { for _, searchPath := range array { searchPath = gstr.TrimRight(searchPath, `\/`) @@ -235,6 +235,12 @@ func (a *AdapterFile) doGetFilePath(fileName string) (filePath string) { } }) } + if filePath == "" { + // Absolute path. + if filePath = gfile.RealPath(fileName); filePath != "" && !gfile.IsDir(filePath) { + return + } + } return }