From 9d5c663618a9320901efda04097f3efa7f23f4bb Mon Sep 17 00:00:00 2001 From: notsure2 Date: Thu, 22 Jul 2021 20:05:30 +0200 Subject: [PATCH] Fix incorrect addition of empty name in MockDomainList if the config string contains AlternativeNames=; --- internal/client/state.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/internal/client/state.go b/internal/client/state.go index 0ab8270..b9f8125 100644 --- a/internal/client/state.go +++ b/internal/client/state.go @@ -154,6 +154,15 @@ func (raw *RawConfig) ProcessRawConfig(worldState common.WorldState) (local Loca return nullErr("ServerName") } auth.MockDomain = raw.ServerName + + var filteredAlternativeNames []string + for _, alternativeName := range raw.AlternativeNames { + if len(alternativeName) > 0 { + filteredAlternativeNames = append(filteredAlternativeNames, alternativeName) + } + } + raw.AlternativeNames = filteredAlternativeNames + local.MockDomainList = raw.AlternativeNames local.MockDomainList = append(local.MockDomainList, auth.MockDomain) if raw.ProxyMethod == "" {