(t *testing.T)
| 356 | } |
| 357 | |
| 358 | func 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 | |
| 386 | func TestParseProxyMediaInfoContentPath_JSON(t *testing.T) { |
| 387 | t.Helper() |
nothing calls this directly
no test coverage detected