-
-
Notifications
You must be signed in to change notification settings - Fork 46
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Extra CR
when getting file over SSH
#201
Comments
👋 I looked into this a bit. If you download your file over curl, you'll notice that it's fine:
However, the problem does come in when fetching over ssh:
The SSH library that snips uses, (wish) is built on top of gliderlabs/ssh. Within that library, I found the following: https://github.com/gliderlabs/ssh/blob/adec695b0aa80b0a03f251e1f8c302f0ea192ef5/session.go#L133-L137 // normalize \n to \r\n when pty is accepted.
// this is a hardcoded shortcut since we don't support terminal modes.
p = bytes.Replace(p, []byte{'\n'}, []byte{'\r', '\n'}, -1)
p = bytes.Replace(p, []byte{'\r', '\r', '\n'}, []byte{'\r', '\n'}, -1) I'll look into this a bit more. |
Looks like wish's ssh fork is doing something slightly different with a For now, you can disable pty allocation:
|
CR
when getting file over SSH
Also updated the issue title to clarify the behavior we're seeing 👍 |
What happened? What is expected?
I put a file into snips.sh that had a single line with a \n character at the end (no \r).
On another system, I retrieved the file using ssh.
I compared the sha256 of the source and the retrieved file and they were not the same.
snips.sh seems to have added a \r before the \n. :(
I expect snips.sh not to change my files in any way whatsoever.
How can we reproduce it?
root@staging:/# echo 'hi' | od -a
0000000 h i nl
0000003
root@staging:/# echo 'hi' | ssh snips.sh
Pseudo-terminal will not be allocated because stdin is not a terminal.
┃ File Uploaded 📤
┃ id: qbH7FNuWG8
┃ size: 3 B • type: plaintext • visibility: public
┃ SSH 📠
┃ ssh f:qbH7FNuWG8@snips.sh
┃ URL 🔗
┃ https://snips.sh/f/qbH7FNuWG8
root@staging:/# ssh f:qbH7FNuWG8@snips.sh | od -a
Connection to snips.sh closed.
0000000 h i cr nl
0000004
Anything else we need to know?
no
The text was updated successfully, but these errors were encountered: