From 0de58e031a3ab7963cf89f4fb3f88fb46557853a Mon Sep 17 00:00:00 2001 From: Solderpunk Date: Thu, 21 Nov 2019 23:03:39 +0200 Subject: [PATCH] Only list world readable files. --- handler.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/handler.go b/handler.go index 326061a..6c101ec 100644 --- a/handler.go +++ b/handler.go @@ -156,6 +156,10 @@ func generateDirectoryListing(path string) string { } listing = "# Directory listing\n\n" for _, file := range files { + // Only list world readable files + if uint64(file.Mode().Perm())&0444 != 0444 { + continue + } listing += fmt.Sprintf("=> %s %s\n", file.Name(), file.Name()) } return listing