diff options
Diffstat (limited to 'contrib/fs/gemini.go')
-rw-r--r-- | contrib/fs/gemini.go | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/contrib/fs/gemini.go b/contrib/fs/gemini.go index 1fb4e20..79dcc63 100644 --- a/contrib/fs/gemini.go +++ b/contrib/fs/gemini.go @@ -127,17 +127,17 @@ func GeminiDirectoryDefault(fsroot, urlroot string, filenames ...string) sr.Hand fsroot = strings.TrimRight(fsroot, "/") return sr.HandlerFunc(func(ctx context.Context, request *sr.Request) *sr.Response { + if !strings.HasPrefix(request.Path, urlroot) { + return nil + } + if !strings.HasSuffix(request.Path, "/") { u := *request.URL u.Path += "/" return gemini.PermanentRedirect(u.String()) } - if !strings.HasPrefix(request.Path, urlroot) { - return nil - } requestpath := strings.Trim(strings.TrimPrefix(request.Path, urlroot), "/") - fpath := filepath.Join(fsroot, requestpath) if isPrivate(fpath) { return nil |