dont panic on empty SRV segments
Apply commit 4349b6fa63
Signed-off-by: Arthur Outhenin-Chalandre <arthur@cri.epita.fr>
This commit is contained in:
parent
3afa45c299
commit
5da8d8ce1b
3
parse.go
3
parse.go
|
@ -95,6 +95,9 @@ func parseRequest(name, zone string) (r recordRequest, err error) {
|
|||
|
||||
// stripUnderscore removes a prefixed underscore from s.
|
||||
func stripUnderscore(s string) string {
|
||||
if len(s) == 0 {
|
||||
return s
|
||||
}
|
||||
if s[0] != '_' {
|
||||
return s
|
||||
}
|
||||
|
|
|
@ -23,6 +23,8 @@ func TestParseRequest(t *testing.T) {
|
|||
{"svc.inter.webs.tests.", "......"},
|
||||
// bare pod type
|
||||
{"pod.inter.webs.tests.", "......"},
|
||||
// SRV request with empty segments
|
||||
{"..webs.mynamespace.svc.inter.webs.tests.", "...webs.mynamespace.svc"},
|
||||
}
|
||||
for i, tc := range tests {
|
||||
m := new(dns.Msg)
|
||||
|
|
Loading…
Reference in New Issue