diff --git a/handler.go b/handler.go index 764d950..ab10646 100644 --- a/handler.go +++ b/handler.go @@ -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)