MCPcopy Index your code
hub / github.com/larksuite/cli / lstatNonDir

Function lstatNonDir

internal/binding/audit.go:82–91  ·  view source on GitHub ↗

lstatNonDir stats the path without following symlinks, rejecting directories. Returns the stat info for downstream steps to reuse.

(target, label string)

Source from the content-addressed store, hash-verified

80// lstatNonDir stats the path without following symlinks, rejecting
81// directories. Returns the stat info for downstream steps to reuse.
82func lstatNonDir(target, label string) (fs.FileInfo, error) {
83 info, err := vfs.Lstat(target)
84 if err != nil {
85 return nil, fmt.Errorf("%s: cannot stat %q: %w", label, target, err)
86 }
87 if info.IsDir() {
88 return nil, fmt.Errorf("%s: path %q is a directory, not a file", label, target)
89 }
90 return info, nil
91}
92
93// resolveSymlinkIfAllowed resolves a symlink to its target when
94// params.AllowSymlinkPath is true, or rejects it otherwise. When the input

Callers 1

AssertSecurePathFunction · 0.85

Calls 2

LstatFunction · 0.92
IsDirMethod · 0.65

Tested by

no test coverage detected