summaryrefslogtreecommitdiff
path: root/main.go
diff options
context:
space:
mode:
Diffstat (limited to 'main.go')
-rw-r--r--main.go9
1 files changed, 1 insertions, 8 deletions
diff --git a/main.go b/main.go
index b5ff613..7326b43 100644
--- a/main.go
+++ b/main.go
@@ -49,14 +49,7 @@ func (handler BoxHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
serve(w, handler.token, "templates/index.html")
} else {
resourceId := path.Base(r.URL.Path)
- f, err := os.Open(filepath.Join(handler.dataPath, resourceId))
- if err != nil {
- log.Println(err)
- w.WriteHeader(http.StatusBadRequest)
- fmt.Fprint(w, err.Error())
- return
- }
- io.Copy(w, f)
+ http.ServeFile(w, r, filepath.Join(handler.dataPath, resourceId))
}
return
case http.MethodDelete: