about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorAlan Pearce2024-04-19 14:50:18 +0200
committerAlan Pearce2024-04-19 14:50:18 +0200
commit8dd538daadc55a935e6dc205d9b2559830818c07 (patch)
tree21409abbb8c392d048eb3bfb3e0a7a68ad285efa
parenta4e0ebceb8e664bf3f6e3dc36df0120a9ea9803e (diff)
downloadwebsite-8dd538daadc55a935e6dc205d9b2559830818c07.tar.lz
website-8dd538daadc55a935e6dc205d9b2559830818c07.tar.zst
website-8dd538daadc55a935e6dc205d9b2559830818c07.zip
use abstracted FS to get 404 page
-rw-r--r--server.go6
1 files changed, 3 insertions, 3 deletions
diff --git a/server.go b/server.go
index 5ed4561..9238c73 100644
--- a/server.go
+++ b/server.go
@@ -101,12 +101,12 @@ func main() {
 	files := http.FS(fs)
 	notFoundHandler := func(c *fiber.Ctx) error {
 		c.Status(fiber.StatusNotFound).Type("html", "utf-8")
-		content, err := fs.ReadFile("public/404.html")
+		content, err := files.Open("public/404.html")
 		if err != nil {
-			content = []byte("404 Not Found")
 			c.Type("txt")
+			return c.SendString("404 Not Found")
 		}
-		return c.Send(content)
+		return c.SendStream(content)
 	}
 	website.Get("/404.html", notFoundHandler)
 	website.Use("/", filesystem.New(filesystem.Config{