summaryrefslogtreecommitdiff
path: root/contrib/fs/file.go
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/fs/file.go')
-rw-r--r--contrib/fs/file.go9
1 files changed, 5 insertions, 4 deletions
diff --git a/contrib/fs/file.go b/contrib/fs/file.go
index cdcd1a9..8cb1aeb 100644
--- a/contrib/fs/file.go
+++ b/contrib/fs/file.go
@@ -6,15 +6,16 @@ import (
"mime"
"strings"
+ "tildegit.org/tjp/gus"
"tildegit.org/tjp/gus/gemini"
)
// FileHandler builds a handler function which serves up a file system.
-func FileHandler(fileSystem fs.FS) gemini.Handler {
- return func(ctx context.Context, req *gemini.Request) *gemini.Response {
+func FileHandler(fileSystem fs.FS) gus.Handler {
+ return func(ctx context.Context, req *gus.Request) *gus.Response {
file, err := fileSystem.Open(strings.TrimPrefix(req.Path, "/"))
if isNotFound(err) {
- return gemini.NotFound("Resource does not exist.")
+ return nil
}
if err != nil {
return gemini.Failure(err)
@@ -26,7 +27,7 @@ func FileHandler(fileSystem fs.FS) gemini.Handler {
}
if isDir {
- return gemini.NotFound("Resource does not exist.")
+ return nil
}
return gemini.Success(mediaType(req.Path), file)