From 8de565cb413e62c03c05a31cced56a5e9214b9b7 Mon Sep 17 00:00:00 2001 From: Niccolo Borgioli Date: Sat, 25 May 2024 00:49:48 +0200 Subject: [PATCH] files 404 --- app/server.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app/server.go b/app/server.go index 697679c..b5e7d3f 100644 --- a/app/server.go +++ b/app/server.go @@ -148,8 +148,14 @@ func handleConnection(conn net.Conn) { log.Fatal(err) } filename := filepath.Join(dir, matches[1]) + + // _, err:=os.Stat(filename) // fmt.Println(file) file, err := os.ReadFile(filename) + if os.IsNotExist(err) { + Respond(conn, Response{Version: request.Version, Code: NotFound}) + return + } if err != nil { log.Fatal(err) }