diff --git a/server/common/files_linux.go b/server/common/files_linux.go index 716088ed..614b550e 100644 --- a/server/common/files_linux.go +++ b/server/common/files_linux.go @@ -1,6 +1,8 @@ package common import ( + "errors" + "io/fs" "os" "syscall" ) @@ -10,5 +12,9 @@ func SafeOsOpenFile(path string, flag int, perm os.FileMode) (*os.File, error) { Log.Debug("common::files safeOsOpenFile err[%s] path[%s]", err.Error(), path) return nil, ErrFilesystemError } - return os.OpenFile(path, flag|syscall.O_NOFOLLOW, perm) + f, err := os.OpenFile(path, flag|syscall.O_NOFOLLOW, perm) + if err != nil && errors.Is(err, fs.ErrNotExist) { + return nil, ErrNotFound + } + return f, err }