Consolidate some quick-failing path tests.

This commit is contained in:
Solderpunk 2020-07-01 16:05:09 +02:00
parent 36378eb1c6
commit 9bce54882a
1 changed files with 1 additions and 8 deletions

View File

@ -67,7 +67,7 @@ func handleGeminiRequest(conn net.Conn, config Config, accessLogEntries chan Log
// Paranoid security measures:
// Fail ASAP if the URL has mapped to a sensitive file
if path == config.CertPath || path == config.KeyPath || path == config.AccessLog || path == config.ErrorLog {
if path == config.CertPath || path == config.KeyPath || path == config.AccessLog || path == config.ErrorLog || filepath.Base(path) == ".molly" {
conn.Write([]byte("51 Not found!\r\n"))
log.Status = 51
return
@ -134,13 +134,6 @@ func handleGeminiRequest(conn net.Conn, config Config, accessLogEntries chan Log
return
}
// Don't serve Molly files
if filepath.Base(path) == ".molly" {
conn.Write([]byte("51 Not found!\r\n"))
log.Status = 51
return
}
// Finally, serve the file or directory
if info.IsDir() {
serveDirectory(URL, path, &log, conn, config, errorLogEntries)