Lint fixes and testing workflow actions
This commit is contained in:
@@ -82,7 +82,7 @@ func (c *Client) uploadMedia(ctx context.Context, data []byte, mimeType string)
|
||||
}
|
||||
|
||||
// downloadMedia downloads media from the Business API using the media ID
|
||||
func (c *Client) downloadMedia(ctx context.Context, mediaID string) ([]byte, string, error) {
|
||||
func (c *Client) downloadMedia(ctx context.Context, mediaID string) (data []byte, mimeType string, err error) {
|
||||
// Step 1: Get the media URL
|
||||
url := fmt.Sprintf("https://graph.facebook.com/%s/%s",
|
||||
c.config.APIVersion,
|
||||
@@ -129,10 +129,11 @@ func (c *Client) downloadMedia(ctx context.Context, mediaID string) ([]byte, str
|
||||
return nil, "", fmt.Errorf("failed to download media, status %d", downloadResp.StatusCode)
|
||||
}
|
||||
|
||||
data, err := io.ReadAll(downloadResp.Body)
|
||||
data, err = io.ReadAll(downloadResp.Body)
|
||||
if err != nil {
|
||||
return nil, "", fmt.Errorf("failed to read media data: %w", err)
|
||||
}
|
||||
|
||||
return data, mediaResp.MimeType, nil
|
||||
mimeType = mediaResp.MimeType
|
||||
return
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user