fix: download link was incorrect. Added hint for saving file
This commit is contained in:
parent
84c85c98fe
commit
d047788835
2
main.go
2
main.go
@ -88,6 +88,7 @@ type Context struct {
|
|||||||
StatusCode int
|
StatusCode int
|
||||||
Err *error
|
Err *error
|
||||||
IsTLS bool
|
IsTLS bool
|
||||||
|
DownloadURL string
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewContext(r *http.Request) *Context {
|
func NewContext(r *http.Request) *Context {
|
||||||
@ -173,6 +174,7 @@ func main() {
|
|||||||
downloadURL := string(body)
|
downloadURL := string(body)
|
||||||
log.Println("URL from convx", downloadURL)
|
log.Println("URL from convx", downloadURL)
|
||||||
|
|
||||||
|
ctx.DownloadURL = downloadURL
|
||||||
err = templates.ExecuteTemplate(w,"download-result.html", ctx)
|
err = templates.ExecuteTemplate(w,"download-result.html", ctx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Println(err.Error())
|
log.Println(err.Error())
|
||||||
|
@ -1,6 +1,9 @@
|
|||||||
<div id="get-btn">
|
<div id="get-btn">
|
||||||
{{ if eq .StatusCode 200 }}
|
{{ if eq .StatusCode 200 }}
|
||||||
<a href="{{ . }}" rel="" download target="_blank">Download</a>
|
<a href="{{ .DownloadURL }}" rel="noopener" download target="_blank">
|
||||||
|
Download
|
||||||
|
</a>
|
||||||
|
<small>Right click and Click "Save link as"</small>
|
||||||
{{ else }}
|
{{ else }}
|
||||||
<button>Try Again
|
<button>Try Again
|
||||||
<!-- <a class="htmx-indicator" href="#" aria-busy="true"></a> -->
|
<!-- <a class="htmx-indicator" href="#" aria-busy="true"></a> -->
|
||||||
|
Loading…
Reference in New Issue
Block a user