Skip to content

Commit aeef898

Browse files
committed
[Bugfix] fix zmodem sz error
1 parent 6e3e06f commit aeef898

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

session.go

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package ssh
22

33
import (
4-
"bytes"
54
"context"
65
"errors"
76
"fmt"
@@ -117,18 +116,19 @@ type session struct {
117116
}
118117

119118
func (sess *session) Write(p []byte) (n int, err error) {
120-
if sess.pty != nil {
121-
m := len(p)
122-
// normalize \n to \r\n when pty is accepted.
123-
// this is a hardcoded shortcut since we don't support terminal modes.
124-
p = bytes.Replace(p, []byte{'\n'}, []byte{'\r', '\n'}, -1)
125-
p = bytes.Replace(p, []byte{'\r', '\r', '\n'}, []byte{'\r', '\n'}, -1)
126-
n, err = sess.Channel.Write(p)
127-
if n > m {
128-
n = m
129-
}
130-
return
131-
}
119+
// If change the \n to \r\n, then zmodem(rzsz) will be error
120+
//if sess.pty != nil {
121+
// m := len(p)
122+
// // normalize \n to \r\n when pty is accepted.
123+
// // this is a hardcoded shortcut since we don't support terminal modes.
124+
// p = bytes.Replace(p, []byte{'\n'}, []byte{'\r', '\n'}, -1)
125+
// p = bytes.Replace(p, []byte{'\r', '\r', '\n'}, []byte{'\r', '\n'}, -1)
126+
// n, err = sess.Channel.Write(p)
127+
// if n > m {
128+
// n = m
129+
// }
130+
// return
131+
//}
132132
return sess.Channel.Write(p)
133133
}
134134

0 commit comments

Comments
 (0)