files 404

This commit is contained in:
Niccolo Borgioli 2024-05-25 00:49:48 +02:00
parent d7ac2a2a57
commit 8de565cb41
No known key found for this signature in database
GPG Key ID: 4897ACD13A65977C

View File

@ -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)
}