diff options
Diffstat (limited to 'contrib/sharedhost')
-rw-r--r-- | contrib/sharedhost/replacement.go | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/contrib/sharedhost/replacement.go b/contrib/sharedhost/replacement.go index 9dc3a1e..cabc6b1 100644 --- a/contrib/sharedhost/replacement.go +++ b/contrib/sharedhost/replacement.go @@ -4,6 +4,7 @@ import ( "context" "crypto/tls" "net/url" + "path" sr "tildegit.org/tjp/sliderule" ) @@ -20,9 +21,9 @@ import ( func ReplaceTilde(replacement string) sr.Middleware { return func(inner sr.Handler) sr.Handler { return sr.HandlerFunc(func(ctx context.Context, request *sr.Request) *sr.Response { - if len(request.Path) > 1 && request.Path[0] == '/' && request.Path[1] == '~' { + if len(request.Path) > 1 && request.Path[0:2] == "/~" { request = cloneRequest(request) - request.Path = "/" + replacement + request.Path[2:] + request.Path = path.Clean("/" + replacement + request.Path[2:]) } return inner.Handle(ctx, request) |