|
@@ -4,6 +4,7 @@ import (
|
|
|
"fmt"
|
|
|
"io"
|
|
|
"io/ioutil"
|
|
|
+ "net/url"
|
|
|
"path/filepath"
|
|
|
"strings"
|
|
|
"time"
|
|
@@ -107,10 +108,16 @@ func (c *Client) GetURL(name string) string {
|
|
|
}
|
|
|
|
|
|
// GetBlob reads a file from S3 and returns the raw bytes.
|
|
|
-func (c *Client) GetBlob(url string) ([]byte, error) {
|
|
|
+func (c *Client) GetBlob(uurl string) ([]byte, error) {
|
|
|
+ if p, err := url.Parse(uurl); err != nil {
|
|
|
+ uurl = filepath.Base(uurl)
|
|
|
+ } else {
|
|
|
+ uurl = filepath.Base(p.Path)
|
|
|
+ }
|
|
|
+
|
|
|
file, err := c.s3.FileDownload(simples3.DownloadInput{
|
|
|
Bucket: c.opts.Bucket,
|
|
|
- ObjectKey: c.makeBucketPath(filepath.Base(url)),
|
|
|
+ ObjectKey: c.makeBucketPath(filepath.Base(uurl)),
|
|
|
})
|
|
|
if err != nil {
|
|
|
return nil, err
|