package admin import "testing" // Regression: the raw file API must canonicalize repeated "/" and "data/" // prefixes, or "//players/..." reaches the real file while the classifiers // see a non-player path and skip the redaction / online refusal. func TestCanonicalDataRelPathStripsRepeatedPrefixes(t *testing.T) { cases := map[string]string{ "players/accounts/x.yaml": "players/accounts/x.yaml", "/players/accounts/x.yaml": "players/accounts/x.yaml", "//players/accounts/x.yaml": "players/accounts/x.yaml", "data/players/accounts/x.yaml": "players/accounts/x.yaml", "data/data/players/accounts/x.yaml": "players/accounts/x.yaml", "../etc/passwd": "etc/passwd", } for in, want := range cases { if got := canonicalDataRelPath(in); got != want { t.Errorf("canonicalDataRelPath(%q) = %q, want %q", in, got, want) } } }