Skip to content

Commit 6b9ebbf

Browse files
committed
fix: Problem with block directives #77
1 parent cba0028 commit 6b9ebbf

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

server/pkg/nginx/parse.go

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,14 @@ func (l *NgxLocation) parseLocation(directive gonginx.IDirective, deep int) {
5353
l.Content += strings.Repeat("\t", deep) + c + "\n"
5454
}
5555
}
56-
l.Content += strings.Repeat("\t", deep) + location.GetName() + " " + strings.Join(location.GetParameters(), " ") + ";\n"
57-
l.parseLocation(location, deep+1)
56+
l.Content += strings.Repeat("\t", deep) + location.GetName() + " " + strings.Join(location.GetParameters(), " ")
57+
if location.GetBlock() != nil && location.GetBlock().GetDirectives() != nil {
58+
l.Content += " { \n"
59+
l.parseLocation(location, deep+1)
60+
l.Content += " } \n"
61+
} else {
62+
l.Content += ";\n"
63+
}
5864
}
5965
}
6066

0 commit comments

Comments
 (0)