Fix BunnyCDN media upload
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
This commit is contained in:
parent
ce0baf0086
commit
0292344035
|
@ -28,7 +28,7 @@ var bunnyCdnStorageUrl = "https://storage.bunnycdn.com"
|
||||||
|
|
||||||
func (b *BunnyCdnStorage) Upload(fileName string, file multipart.File) (location string, err error) {
|
func (b *BunnyCdnStorage) Upload(fileName string, file multipart.File) (location string, err error) {
|
||||||
client := http.DefaultClient
|
client := http.DefaultClient
|
||||||
req, _ := http.NewRequest(http.MethodPut, bunnyCdnStorageUrl+"/"+url.PathEscape(b.storageZoneName)+"/"+url.PathEscape("/"+fileName), file)
|
req, _ := http.NewRequest(http.MethodPut, bunnyCdnStorageUrl+"/"+url.PathEscape(b.storageZoneName)+"/"+url.PathEscape(fileName), file)
|
||||||
req.Header.Add("AccessKey", b.key)
|
req.Header.Add("AccessKey", b.key)
|
||||||
resp, err := client.Do(req)
|
resp, err := client.Do(req)
|
||||||
if err != nil || resp.StatusCode != 201 {
|
if err != nil || resp.StatusCode != 201 {
|
||||||
|
|
Reference in New Issue