MCPcopy
hub / github.com/autobrr/qui / TestNormalizeContentPathRelativeInput

Function TestNormalizeContentPathRelativeInput

internal/proxy/handler_test.go:358–384  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

356}
357
358func TestNormalizeContentPathRelativeInput(t *testing.T) {
359 t.Helper()
360
361 testCases := []struct {
362 name string
363 input string
364 wantError bool
365 }{
366 {name: "valid", input: "folder/file.mkv", wantError: false},
367 {name: "empty", input: "", wantError: true},
368 {name: "traversal", input: "../escape.mkv", wantError: true},
369 {name: "windows-traversal", input: "..\\escape.mkv", wantError: true},
370 }
371
372 for _, tc := range testCases {
373 t.Run(tc.name, func(t *testing.T) {
374 normalized, err := normalizeContentPathRelativeInput(tc.input)
375 if tc.wantError {
376 require.Error(t, err)
377 return
378 }
379
380 require.NoError(t, err)
381 require.Equal(t, filepath.FromSlash(tc.input), normalized)
382 })
383 }
384}
385
386func TestParseProxyMediaInfoContentPath_JSON(t *testing.T) {
387 t.Helper()

Callers

nothing calls this directly

Calls 3

RunMethod · 0.80
ErrorMethod · 0.45

Tested by

no test coverage detected