debug eof
This commit is contained in:
parent
78d818b8d1
commit
981b745c9e
1 changed files with 20 additions and 1 deletions
|
@ -11,7 +11,6 @@ func handleFile(w http.ResponseWriter, r *http.Request) {
|
|||
http.Error(w, "No id", http.StatusBadRequest)
|
||||
return
|
||||
}
|
||||
|
||||
// TODO check if worker is working on a task involving this file
|
||||
|
||||
var path string
|
||||
|
@ -22,5 +21,25 @@ func handleFile(w http.ResponseWriter, r *http.Request) {
|
|||
return
|
||||
}
|
||||
|
||||
slog.InfoContext(r.Context(), "Serving File Download", "id", id, "path", path)
|
||||
|
||||
// had timeout issues
|
||||
http.ServeFile(w, r, path)
|
||||
|
||||
/*
|
||||
reader, err := os.Open(path)
|
||||
if err != nil {
|
||||
http.Error(w, "Error Opening File: "+err.Error(), http.StatusInternalServerError)
|
||||
slog.ErrorContext(r.Context(), "Opening File", "err", err)
|
||||
return
|
||||
}
|
||||
|
||||
w.Header().Set("Content-Disposition", "attachment;filename="+filepath.Base(path))
|
||||
_, err = io.Copy(w, reader)
|
||||
if err != nil {
|
||||
http.Error(w, "Copy File: "+err.Error(), http.StatusBadRequest)
|
||||
slog.ErrorContext(r.Context(), "Copy File", "err", err)
|
||||
return
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue