diff --git a/webcontroller/file_viewer.go b/webcontroller/file_viewer.go index 3f227ba..779e279 100644 --- a/webcontroller/file_viewer.go +++ b/webcontroller/file_viewer.go @@ -83,6 +83,13 @@ func (wc *WebController) serveFileViewer(w http.ResponseWriter, r *http.Request, return } + // If the user agent is Wget we redirect it to the API so that the file can + // be downloaded directly + if strings.HasPrefix(r.UserAgent(), "Wget/") { + http.Redirect(w, r, "/api/file/"+p.ByName("id"), http.StatusSeeOther) + return + } + var ids = strings.Split(p.ByName("id"), ",") templateData := wc.newTemplateData(w, r)