diff options
| author | tjpcc <tjp@ctrl-c.club> | 2023-10-18 12:49:14 -0600 |
|---|---|---|
| committer | tjpcc <tjp@ctrl-c.club> | 2023-10-18 12:49:14 -0600 |
| commit | ad7fbaae7a2001502582e6daa27eaffad8a3c447 (patch) | |
| tree | 6330cf924fe19e61d8f047d7173678cc49a7ba9e /parse.go | |
| parent | 059d44027018f1eaa69d3a0f9779da78eb651ced (diff) | |
fix Modifiers.Empty() and "git with templates"
Diffstat (limited to 'parse.go')
| -rw-r--r-- | parse.go | 13 |
1 files changed, 11 insertions, 2 deletions
@@ -265,9 +265,18 @@ func parseServerDirectives(server *Server, buf *bufio.Reader) error { return nil } +func emptyExceptTemplates(mods *Modifiers) bool { + if mods == nil { + return true + } + cpy := *mods + cpy.Templates = nil + return cpy.Empty() +} + func validateRoute(serverType string, dir *RouteDirective) error { - if dir.Type == "git" && !dir.Modifiers.Empty() { - return errors.New("git directives don't support 'with' modifiers") + if dir.Type == "git" && !emptyExceptTemplates(&dir.Modifiers) { + return errors.New("unsupported 'with' modifier on 'git' directive") } if dir.Type == "cgi" && (dir.Modifiers.Exec || dir.Modifiers.DirList || dir.Modifiers.DirDefault != "") { |
