fix(api): normalise empty Authentik public paths

Co-Authored-By: Virgil <virgil@lethean.io>
This commit is contained in:
Virgil 2026-04-02 13:55:17 +00:00
parent a6693e1656
commit 0a299b79c1
2 changed files with 15 additions and 0 deletions

View file

@ -268,6 +268,10 @@ func normalisePublicPaths(paths []string) []string {
out = append(out, path)
}
if len(out) == 0 {
return nil
}
return out
}

View file

@ -231,6 +231,17 @@ func TestEngine_AuthentikConfig_Good_NormalisesPublicPaths(t *testing.T) {
}
}
func TestEngine_AuthentikConfig_Good_BlankPublicPathsRemainNil(t *testing.T) {
e, _ := api.New(api.WithAuthentik(api.AuthentikConfig{
PublicPaths: []string{" ", "\t", ""},
}))
cfg := e.AuthentikConfig()
if cfg.PublicPaths != nil {
t.Fatalf("expected blank public paths to collapse to nil, got %v", cfg.PublicPaths)
}
}
func TestEngine_Register_Good_IgnoresNilGroups(t *testing.T) {
e, _ := api.New()