~emersion/public-inbox

This thread contains a patchset. You're looking at the original emails, but you may wish to use the patch review UI. Review patch
2 2

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

Details
Message ID
<20201202011141.81427-1-slowjo@halmen.xyz>
DKIM signature
missing
Download raw message
Patch: +3 -3
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
Details
Message ID
<FcwQbRlGxo1uyTxJ3idciMmzFPADAUIcl_om8i1FoTfAgcOKTxF7HKSvrmVkHimuNSOiajO9JzZ01svbV-yy5N_WArNxczE5F-VTDl_tiGo=@emersion.fr>
In-Reply-To
<20201202011141.81427-1-slowjo@halmen.xyz> (view parent)
DKIM signature
fail
Download raw message
DKIM signature: fail
On Wednesday, December 2, 2020 2:11 AM, Jonathan Halmen <slowjo@halmen.xyz> wrote:

> 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.

That was a mistake in my examples, we should require it.
Jonathan Halmen
Details
Message ID
<C7I99W46DK6L.9EILFHZEDK1U@len>
In-Reply-To
<FcwQbRlGxo1uyTxJ3idciMmzFPADAUIcl_om8i1FoTfAgcOKTxF7HKSvrmVkHimuNSOiajO9JzZ01svbV-yy5N_WArNxczE5F-VTDl_tiGo=@emersion.fr> (view parent)
DKIM signature
missing
Download raw message
> That was a mistake in my examples, we should require it.

In this case v1 of this patch is ready to go.
Reply to thread Export thread (mbox)