From 8ae3feeb9fc9eb77162afa9750d3ecff1aca9727 Mon Sep 17 00:00:00 2001 From: Cassondra Foesch Date: Thu, 24 Sep 2020 15:20:10 +0000 Subject: [PATCH] add NOTEs everywhere symlink target/linkpath vs sftp.Request.Filepath and sfftp.Request.Target come up --- request-example.go | 1 + request.go | 2 ++ 2 files changed, 3 insertions(+) diff --git a/request-example.go b/request-example.go index f5d18c6..76e769e 100644 --- a/request-example.go +++ b/request-example.go @@ -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) } diff --git a/request.go b/request.go index 4f3095c..e452752 100644 --- a/request.go +++ b/request.go @@ -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)