Skip to content

Commit

Permalink
Show local directory index file if available (#319)
Browse files Browse the repository at this point in the history
  • Loading branch information
sotpapathe authored Sep 27, 2023
1 parent 818604f commit e35ba06
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions display/file.go
Original file line number Diff line number Diff line change
Expand Up @@ -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") {
Expand Down

0 comments on commit e35ba06

Please sign in to comment.