lstatNonDir stats the path without following symlinks, rejecting directories. Returns the stat info for downstream steps to reuse.
(target, label string)
| 80 | // lstatNonDir stats the path without following symlinks, rejecting |
| 81 | // directories. Returns the stat info for downstream steps to reuse. |
| 82 | func 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 |
no test coverage detected