~emersion/public-inbox

kimchi: fix site configs with path in uri v2 PROPOSED

Jonathan Halmen: 1
 fix site configs with path in uri

 1 files changed, 3 insertions(+), 3 deletions(-)
Export patchset (mbox)
How do I use this?

Copy & paste the following snippet into your terminal to import this patchset into git:

curl -s https://lists.sr.ht/~emersion/public-inbox/patches/15415/mbox | git am -3
Learn more about email & git
View this thread in the archives

[PATCH kimchi v2] fix site configs with path in uri Export this patch

This actually makes site configs such as the following work

site foo.example.org/foo {
  file_server /path/to/index/html/
}
---
The last patch actually didn't work correctly unless a trailing slash
would be added in the config. Making sure there is going to be one is
probably better than requiring it in the config.
 directives.go | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/directives.go b/directives.go
index 7c29464..03d0c41 100644
--- a/directives.go
+++ b/directives.go
@@ -71,8 +71,8 @@ func parseSite(srv *Server, dir *scfg.Directive) error {
		}

		path := u.Path
		if path == "" {
			path = "/"
		if !strings.HasSuffix(path, "/") {
			path += "/"
		}
		if !strings.HasPrefix(path, "/") {
			return fmt.Errorf("site %q: invalid path %q", site, path)
@@ -115,7 +115,7 @@ func parseSite(srv *Server, dir *scfg.Directive) error {
			}
		}

		ln.Mux.Handle(pattern, handler)
		ln.Mux.Handle(pattern, http.StripPrefix(path, handler))
	}
	return nil
}
-- 
2.29.2