diff options
Diffstat (limited to 'src/http')
-rw-r--r-- | src/http/http.go | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/src/http/http.go b/src/http/http.go index 824c7a3..83faa93 100644 --- a/src/http/http.go +++ b/src/http/http.go @@ -46,21 +46,16 @@ func downloadHandler(w http.ResponseWriter, r *http.Request) { file := query["file"][0] - logrus.Info(file) - root := viper.GetString("server.root") logrus.Info(root) strippedFile := strings.Replace(file, root, "", -1) strippedFile = strings.Replace(strippedFile, "..", "", -1) - logrus.Info(strippedFile) - logrus.Infof("stripped: %s", strippedFile) - w.Header().Set("Content-Disposition", fmt.Sprintf("attachment; filename=%s", strippedFile)) w.Header().Set("Content-Type", r.Header.Get("Content-Type")) - actualFile := fmt.Sprintf("%s/%s", root, strippedFile) - logrus.Infof("actual: %s", actualFile) + actualFile := fmt.Sprintf("%s%s", root, strippedFile) + logrus.Infof("serving: %s", actualFile) http.ServeFile(w, r, actualFile) } |