Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions attrs.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ type FileStat struct {
UID uint32
GID uint32
Extended []StatExtended
Longname string

@puellanivis puellanivis Jul 24, 2026

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

longname is not a part of this structure, it’s a part of the SSH_FXP_NAME name entry sub-structure: https://datatracker.ietf.org/doc/html/draft-ietf-secsh-filexfer-02#section-7

If you have need to access this and want to get it added in, it should be put in the fileInfo struct:

sftp/attrs.go

Lines 23 to 26 in fc82c35

type fileInfo struct {
name string
stat *FileStat
}
and then we can expose a LongName() string receiver method that you can then test with .(interface{ LongName() string }) to use it.

}

// ModTime returns the Mtime SFTP file attribute converted to a time.Time
Expand Down
4 changes: 3 additions & 1 deletion client.go
Original file line number Diff line number Diff line change
Expand Up @@ -405,12 +405,14 @@ func (c *Client) ReadDirContext(ctx context.Context, p string) ([]os.FileInfo, e
for i := uint32(0); i < count; i++ {
var filename string
filename, data = unmarshalString(data)
_, data = unmarshalString(data) // discard longname
var longname string
longname, data = unmarshalString(data)
var attr *FileStat
attr, data, err = unmarshalAttrs(data)
if err != nil {
return nil, err
}
attr.Longname = longname
if filename == "." || filename == ".." {
continue
}
Expand Down