Fixed issues with backslashes on windows systems
diff --git a/request-server.go b/request-server.go
index b51a10b..db45522 100644
--- a/request-server.go
+++ b/request-server.go
@@ -186,7 +186,8 @@
path = "/" + path
} // all paths are absolute
- cleaned_path := filepath.Clean(path)
+ cleaned_path := filepath.ToSlash(filepath.Clean(path))
+
return &sshFxpNamePacket{
ID: pkt.id(),
NameAttrs: []sshFxpNameAttr{{
diff --git a/request.go b/request.go
index 6d7d6ff..5b7502f 100644
--- a/request.go
+++ b/request.go
@@ -52,16 +52,16 @@
request.Flags = p.Flags
request.Attrs = p.Attrs.([]byte)
case *sshFxpRenamePacket:
- request.Target = filepath.Clean(p.Newpath)
+ request.Target = filepath.ToSlash(filepath.Clean(p.Newpath))
case *sshFxpSymlinkPacket:
- request.Target = filepath.Clean(p.Linkpath)
+ request.Target = filepath.ToSlash(filepath.Clean(p.Linkpath))
}
return request
}
// NewRequest creates a new Request object.
func NewRequest(method, path string) Request {
- request := Request{Method: method, Filepath: filepath.Clean(path)}
+ request := Request{Method: method, Filepath: filepath.ToSlash(filepath.Clean(path))}
request.packets = make(chan packet_data, sftpServerWorkerCount)
request.state = &state{}
request.stateLock = &sync.RWMutex{}
@@ -239,7 +239,7 @@
switch r.Method {
case "List":
pd := r.popPacket()
- dirname := path.Base(r.Filepath)
+ dirname := filepath.ToSlash(path.Base(r.Filepath))
ret := &sshFxpNamePacket{ID: pd.id}
for _, fi := range finfo {
ret.NameAttrs = append(ret.NameAttrs, sshFxpNameAttr{