mirror of
https://github.com/coredns/coredns.git
synced 2025-11-01 18:53:43 -04:00
fix: convert key to domain (#5064)
fix convert key to domain when key ends with '/'
This commit is contained in:
@@ -22,6 +22,9 @@ func Path(s, prefix string) string {
|
||||
// Domain is the opposite of Path.
|
||||
func Domain(s string) string {
|
||||
l := strings.Split(s, "/")
|
||||
if l[len(l)-1] == "" {
|
||||
l = l[:len(l)-1]
|
||||
}
|
||||
// start with 1, to strip /skydns
|
||||
for i, j := 1, len(l)-1; i < j; i, j = i+1, j-1 {
|
||||
l[i], l[j] = l[j], l[i]
|
||||
|
||||
Reference in New Issue
Block a user