fix(api): normalise empty Authentik public paths
Co-Authored-By: Virgil <virgil@lethean.io>
This commit is contained in:
parent
a6693e1656
commit
0a299b79c1
2 changed files with 15 additions and 0 deletions
|
|
@ -268,6 +268,10 @@ func normalisePublicPaths(paths []string) []string {
|
|||
out = append(out, path)
|
||||
}
|
||||
|
||||
if len(out) == 0 {
|
||||
return nil
|
||||
}
|
||||
|
||||
return out
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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()
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue