fix: do not expose the name of the root directory

pull/5224/head
Henrique Dias 2025-06-28 08:26:18 +02:00
parent 5331969163
commit 0474e40877
No known key found for this signature in database
1 changed files with 5 additions and 0 deletions

View File

@ -86,6 +86,11 @@ func NewFileInfo(opts *FileOptions) (*FileInfo, error) {
return nil, err
}
// Do not expose the name of root directory.
if file.Path == "/" {
file.Name = "/"
}
if opts.Expand {
if file.IsDir {
if err := file.readListing(opts.Checker, opts.ReadHeader); err != nil { //nolint:govet