1
0
Fork 0

Read header for directory listings from .mollyhead.

This commit is contained in:
Solderpunk 2020-06-11 22:43:13 +02:00
parent b0b18971f4
commit e57a3d5ecf

View file

@ -270,6 +270,15 @@ func generateDirectoryListing(URL *url.URL, path string) string {
log.Fatal(err)
}
listing = "# Directory listing\n\n"
// Override with .mollyhead file
header_path := filepath.Join(path, ".mollyhead")
_, err = os.Stat(header_path)
if err == nil {
header, err := ioutil.ReadFile(header_path)
if err == nil {
listing = string(header)
}
}
// Do "up" link first
if URL.Path != "/" {
if strings.HasSuffix(URL.Path, "/") {