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
 | 
			
		||||
    Err *error
 | 
			
		||||
    IsTLS bool
 | 
			
		||||
    DownloadURL string
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func NewContext(r *http.Request) *Context {
 | 
			
		||||
@ -173,6 +174,7 @@ func main() {
 | 
			
		||||
            downloadURL := string(body)
 | 
			
		||||
            log.Println("URL from convx", downloadURL)
 | 
			
		||||
            
 | 
			
		||||
            ctx.DownloadURL = downloadURL
 | 
			
		||||
            err = templates.ExecuteTemplate(w,"download-result.html", ctx)
 | 
			
		||||
            if err != nil {
 | 
			
		||||
                log.Println(err.Error())
 | 
			
		||||
 | 
			
		||||
@ -1,6 +1,9 @@
 | 
			
		||||
<div id="get-btn">
 | 
			
		||||
{{ 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 }}
 | 
			
		||||
<button>Try Again
 | 
			
		||||
    <!-- <a class="htmx-indicator" href="#" aria-busy="true"></a> -->
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user