Co-authored-by: clawbot <clawbot@openclaw> Co-authored-by: Jeffrey Paul <sneak@noreply.example.org> Reviewed-on: #18 Co-authored-by: clawbot <clawbot@noreply.example.org> Co-committed-by: clawbot <clawbot@noreply.example.org>
This commit was merged in pull request #18.
This commit is contained in:
@@ -16,6 +16,29 @@ import (
|
||||
"sneak.berlin/go/mfer/mfer"
|
||||
)
|
||||
|
||||
func TestEncodeFilePath(t *testing.T) {
|
||||
tests := []struct {
|
||||
input string
|
||||
expected string
|
||||
}{
|
||||
{"file.txt", "file.txt"},
|
||||
{"dir/file.txt", "dir/file.txt"},
|
||||
{"my file.txt", "my%20file.txt"},
|
||||
{"dir/my file.txt", "dir/my%20file.txt"},
|
||||
{"file#1.txt", "file%231.txt"},
|
||||
{"file?v=1.txt", "file%3Fv=1.txt"},
|
||||
{"path/to/file with spaces.txt", "path/to/file%20with%20spaces.txt"},
|
||||
{"100%done.txt", "100%25done.txt"},
|
||||
}
|
||||
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.input, func(t *testing.T) {
|
||||
result := encodeFilePath(tt.input)
|
||||
assert.Equal(t, tt.expected, result)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func TestSanitizePath(t *testing.T) {
|
||||
// Valid paths that should be accepted
|
||||
validTests := []struct {
|
||||
|
||||
Reference in New Issue
Block a user