summaryrefslogtreecommitdiff
path: root/contrib/fs/gopher.go
diff options
context:
space:
mode:
authortjp <tjp@ctrl-c.club>2023-11-14 09:39:53 -0700
committertjp <tjp@ctrl-c.club>2023-11-14 09:39:53 -0700
commitc22799fa12c99932fc4620fce2dc0994567a52af (patch)
tree5c89892e82f0ca805af976a2d2038a690152d4c6 /contrib/fs/gopher.go
parente599f0e2d4f8177143478ba17189e1ef656b7fe0 (diff)
bugfixes from the Protocol refactorv1.6.0
Diffstat (limited to 'contrib/fs/gopher.go')
-rw-r--r--contrib/fs/gopher.go13
1 files changed, 12 insertions, 1 deletions
diff --git a/contrib/fs/gopher.go b/contrib/fs/gopher.go
index 209a4ec..22cdbc3 100644
--- a/contrib/fs/gopher.go
+++ b/contrib/fs/gopher.go
@@ -29,7 +29,18 @@ func GopherDirectoryDefault(fsroot, urlroot string, settings *gophermap.FileSyst
}
handler := directoryDefault(gopher.ServerProtocol, fsroot, urlroot, false, settings.DirMaps...)
- return gophermap.ExtendMiddleware(fsroot, urlroot, settings)(handler)
+
+ // force response status to MenuType since we hit a directory default file
+ menuHandler := sr.HandlerFunc(func(ctx context.Context, request *sr.Request) *sr.Response {
+ response := handler.Handle(ctx, request)
+ if response == nil {
+ return response
+ }
+ response.Status = gopher.MenuType
+ return response
+ })
+
+ return gophermap.ExtendMiddleware(fsroot, urlroot, settings)(menuHandler)
}
// GopherDirectoryListing produces a listing of the contents of any requested directories.