feature: Hide Dotfiles
And Dotdirs if thats a thing. Enabled by default, use envvars to disable this feature.
This commit is contained in:
@@ -23,6 +23,7 @@ var (
|
||||
privateDirectory embed.FS
|
||||
serveHash = fmt.Sprintf("%X", time.Now().Unix())
|
||||
serveDirectory = os.Getenv("HTTP_DIRECTORY")
|
||||
serveDotfiles = os.Getenv("HTTP_SHOW_DOTFILES")
|
||||
serveAddress = os.Getenv("HTTP_ADDRESS")
|
||||
tmpl = template.Must(
|
||||
template.
|
||||
@@ -194,6 +195,11 @@ func main() {
|
||||
continue
|
||||
}
|
||||
|
||||
// Ignore Dotfiles
|
||||
if serveDotfiles != "" && strings.HasPrefix(entry.Name(), ".") {
|
||||
continue
|
||||
}
|
||||
|
||||
// Check Symbolic Link
|
||||
isDir := entry.IsDir()
|
||||
if entry.Type()&os.ModeSymlink != 0 {
|
||||
|
||||
Reference in New Issue
Block a user