diff --git a/server.go b/server.go index 5b200d2..3efc659 100644 --- a/server.go +++ b/server.go @@ -6,18 +6,18 @@ import ( "net/http" "os" "os/signal" - "path" + "path/filepath" ) func viewHandler(root string, w http.ResponseWriter, r *http.Request) { - file := path.Join(root, r.URL.Path[1:]) + file := filepath.Join(root, r.URL.Path[1:]) info, err := os.Stat(file) if err != nil { fmt.Fprint(w, err) return } if info.IsDir() { - file = path.Join(file, "index.html") + file = filepath.Join(file, "index.html") } fmt.Println("GET " + file) content, _ := goutil.ReadFile(file)