add NOTEs everywhere symlink target/linkpath vs sftp.Request.Filepath and sfftp.Request.Target come up

This commit is contained in:
Cassondra Foesch 2020-09-24 15:20:10 +00:00
parent 42f3825de9
commit 8ae3feeb9f
2 changed files with 3 additions and 0 deletions

View File

@ -159,6 +159,7 @@ func (fs *root) Filecmd(r *Request) error {
return fs.link(r.Filepath, r.Target)
case "Symlink":
// NOTE: r.Filepath is the target, and r.Target is the linkpath.
return fs.symlink(r.Filepath, r.Target)
}

View File

@ -57,6 +57,8 @@ func requestFromPacket(ctx context.Context, pkt hasPath) *Request {
case *sshFxpRenamePacket:
request.Target = cleanPath(p.Newpath)
case *sshFxpSymlinkPacket:
// NOTE: given a POSIX compliant signature: symlink(target, linkpath string)
// this makes Request.Target the linkpath, and Request.Filepath the target.
request.Target = cleanPath(p.Linkpath)
case *sshFxpExtendedPacketHardlink:
request.Target = cleanPath(p.Newpath)