From e35ba06cf99d404a94c3da3d108eff46ae185898 Mon Sep 17 00:00:00 2001 From: Sotiris Papatheodorou Date: Thu, 28 Sep 2023 00:14:35 +0200 Subject: [PATCH] Show local directory index file if available (#319) --- display/file.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/display/file.go b/display/file.go index df9cb597..7fef92ea 100644 --- a/display/file.go +++ b/display/file.go @@ -35,6 +35,12 @@ func handleFile(u string) (*structs.Page, bool) { if u[len(u)-1] != '/' { u += "/" } + for _, index := range []string{"index.gmi", "index.gemini"} { + m, err := os.Stat(uri.Path + "/" + index) + if err == nil && !m.IsDir() { + return handleFile(u + index) + } + } return createDirectoryListing(u) case mode.IsRegular(): if fi.Size() > viper.GetInt64("a-general.page_max_size") {