mirror of
https://github.com/rclone/rclone.git
synced 2025-08-17 00:51:34 +02:00
serve sftp: serve an rclone remote over SFTP
This commit is contained in:
25
cmd/serve/sftp/connection_test.go
Normal file
25
cmd/serve/sftp/connection_test.go
Normal file
@ -0,0 +1,25 @@
|
||||
// +build !plan9
|
||||
|
||||
package sftp
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func TestShellEscape(t *testing.T) {
|
||||
for i, test := range []struct {
|
||||
unescaped, escaped string
|
||||
}{
|
||||
{"", ""},
|
||||
{"/this/is/harmless", "/this/is/harmless"},
|
||||
{"$(rm -rf /)", "\\$\\(rm\\ -rf\\ /\\)"},
|
||||
{"/test/\n", "/test/'\n'"},
|
||||
{":\"'", ":\\\"\\'"},
|
||||
} {
|
||||
got := shellUnEscape(test.escaped)
|
||||
assert.Equal(t, test.unescaped, got, fmt.Sprintf("Test %d unescaped = %q", i, test.unescaped))
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user