cleanup
This commit is contained in:
parent
0cc4a8a92f
commit
fb405dc55c
15
main.go
15
main.go
@ -183,21 +183,12 @@ func handleDownload(w http.ResponseWriter, r *http.Request) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ctx.DownloadURL = downloadURL
|
ctx.DownloadURL = downloadURL
|
||||||
w.Header().Add(
|
ctx.DownloadURL = fmt.Sprintf("/download-direct?URL=%s&filename=%s",
|
||||||
"Hx-Redirect",
|
|
||||||
fmt.Sprintf("/download-direct?URL=%s&filename=%s",
|
|
||||||
url.QueryEscape(ctx.DownloadURL),
|
url.QueryEscape(ctx.DownloadURL),
|
||||||
url.QueryEscape(filename)),
|
url.QueryEscape(filename),
|
||||||
)
|
)
|
||||||
|
|
||||||
err = templates.ExecuteTemplate(w,"download-result.html", ctx)
|
w.Header().Add("Hx-Redirect", ctx.DownloadURL)
|
||||||
if err != nil {
|
|
||||||
log.Println(err.Error())
|
|
||||||
ctx.StatusCode = 500
|
|
||||||
ctx.Err = &err
|
|
||||||
err = templates.ExecuteTemplate(w,"download-result.html", ctx)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func handleDirectDownload(w http.ResponseWriter, r *http.Request) {
|
func handleDirectDownload(w http.ResponseWriter, r *http.Request) {
|
||||||
|
Loading…
Reference in New Issue
Block a user