diff options
Diffstat (limited to 'contrib/fs/gemini.go')
-rw-r--r-- | contrib/fs/gemini.go | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/contrib/fs/gemini.go b/contrib/fs/gemini.go index 4193493..15677f1 100644 --- a/contrib/fs/gemini.go +++ b/contrib/fs/gemini.go @@ -14,7 +14,7 @@ import ( // // It only serves responses for paths which do not correspond to directories on disk. func GeminiFileHandler(fileSystem fs.FS) gus.Handler { - return func(ctx context.Context, request *gus.Request) *gus.Response { + return gus.HandlerFunc(func(ctx context.Context, request *gus.Request) *gus.Response { filepath, file, err := ResolveFile(request, fileSystem) if err != nil { return gemini.Failure(err) @@ -25,7 +25,7 @@ func GeminiFileHandler(fileSystem fs.FS) gus.Handler { } return gemini.Success(mediaType(filepath), file) - } + }) } // GeminiDirectoryDefault serves up default files for directory path requests. @@ -42,7 +42,7 @@ func GeminiFileHandler(fileSystem fs.FS) gus.Handler { // It requires that files from the provided fs.FS implement fs.ReadDirFile. If they // don't, it will produce nil responses for any directory paths. func GeminiDirectoryDefault(fileSystem fs.FS, filenames ...string) gus.Handler { - return func(ctx context.Context, request *gus.Request) *gus.Response { + return gus.HandlerFunc(func(ctx context.Context, request *gus.Request) *gus.Response { dirpath, dir, response := handleDirGemini(request, fileSystem) if response != nil { return response @@ -61,7 +61,7 @@ func GeminiDirectoryDefault(fileSystem fs.FS, filenames ...string) gus.Handler { } return gemini.Success(mediaType(filepath), file) - } + }) } // GeminiDirectoryListing produces a listing of the contents of any requested directories. @@ -78,7 +78,7 @@ func GeminiDirectoryDefault(fileSystem fs.FS, filenames ...string) gus.Handler { // The template may be nil, in which case DefaultGeminiDirectoryList is used instead. The // template is then processed with RenderDirectoryListing. func GeminiDirectoryListing(fileSystem fs.FS, template *template.Template) gus.Handler { - return func(ctx context.Context, request *gus.Request) *gus.Response { + return gus.HandlerFunc(func(ctx context.Context, request *gus.Request) *gus.Response { dirpath, dir, response := handleDirGemini(request, fileSystem) if response != nil { return response @@ -97,7 +97,7 @@ func GeminiDirectoryListing(fileSystem fs.FS, template *template.Template) gus.H } return gemini.Success("text/gemini", body) - } + }) } // DefaultGeminiDirectoryList is a template which renders a reasonable gemtext dir list. |