fix: Problem with block directives #77

This commit is contained in:
0xJacky 2023-02-09 21:06:01 +08:00
parent cba0028c4f
commit 6b9ebbfcc6
No known key found for this signature in database
GPG key ID: B6E4A6E4A561BAF0

View file

@ -53,8 +53,14 @@ func (l *NgxLocation) parseLocation(directive gonginx.IDirective, deep int) {
l.Content += strings.Repeat("\t", deep) + c + "\n"
}
}
l.Content += strings.Repeat("\t", deep) + location.GetName() + " " + strings.Join(location.GetParameters(), " ") + ";\n"
l.parseLocation(location, deep+1)
l.Content += strings.Repeat("\t", deep) + location.GetName() + " " + strings.Join(location.GetParameters(), " ")
if location.GetBlock() != nil && location.GetBlock().GetDirectives() != nil {
l.Content += " { \n"
l.parseLocation(location, deep+1)
l.Content += " } \n"
} else {
l.Content += ";\n"
}
}
}