func downloader(svc *hsdp.S3Client, expire int) echo.HandlerFunc {
    return func(e echo.Context) error {
        key := e.QueryParam("key")
        if key == "" {
            key = e.Param("*")
        }
        log.Printf("Downloading: %s", key)
        req, _ := svc.GetObjectRequest(&s3.GetObjectInput{
            Bucket: aws.String(svc.Bucket),
            Key:    aws.String(key),
        })
        str, err := req.Presign(time.Duration(expire) * time.Minute)
        if err != nil {
            return e.String(http.StatusBadRequest, err.Error())
        }
        return e.Redirect(http.StatusTemporaryRedirect, str)
    }
}
// downloader generates HTTP 307 redirects to pre-signed bucket key URLs
downloader generates HTTP 307 redirects to pre-signed bucket key URLs
// downloader generates HTTP 307 redirects to pre - signed bucket key URLs
func downloader(svc *hsdp.S3Client, expire int) echo.HandlerFunc {
    return func(e echo.Context) error {
        key := e.QueryParam("key")
        if key == "" {
            key = e.Param("*")
        }
        log.Printf("Downloading: %s", key)
        req, _ := svc.GetObjectRequest(&s3.GetObjectInput{
            Bucket: aws.String(svc.Bucket),
            Key:    aws.String(key),
        })
        str, err := req.Presign(time.Duration(expire) * time.Minute)
        if err != nil {
            return e.String(http.StatusBadRequest, err.Error())
        }
        return e.Redirect(http.StatusTemporaryRedirect, str)
    }
}
func downloader ( svc * hsdp . S3Client , expire int ) echo . HandlerFunc { return func ( e echo . Context ) error { key := e . QueryParam ( " " ) if key == " " { key = e . Param ( " " ) } log . Printf ( " " , key ) req , _ := svc . GetObjectRequest ( & s3 . GetObjectInput { Bucket : aws . String ( svc . Bucket ) , Key : aws . String ( key ) , } ) str , err := req . Presign ( time . Duration ( expire ) * time . Minute ) if err != nil { return e . String ( http . StatusBadRequest , err . Error ( ) ) } return e . Redirect ( http . StatusTemporaryRedirect , str ) } }
downloader generates HTTP 307 redirects to pre-signed bucket key URLs
downloader generates HTTP 307 redirects to pre - signed bucket key URLs