Lint fixes and testing workflow actions
This commit is contained in:
@@ -32,8 +32,8 @@ func (c *Client) HandleWebhook(r *http.Request) error {
|
||||
|
||||
// Process each entry
|
||||
for _, entry := range payload.Entry {
|
||||
for _, change := range entry.Changes {
|
||||
c.processChange(change)
|
||||
for i := range entry.Changes {
|
||||
c.processChange(entry.Changes[i])
|
||||
}
|
||||
}
|
||||
|
||||
@@ -198,10 +198,8 @@ func (c *Client) parseTimestamp(ts string) time.Time {
|
||||
}
|
||||
|
||||
// processMediaData processes media based on the configured mode
|
||||
func (c *Client) processMediaData(messageID string, data []byte, mimeType string, mediaBase64 *string) (string, string) {
|
||||
func (c *Client) processMediaData(messageID string, data []byte, mimeType string, mediaBase64 *string) (filename string, mediaURL string) {
|
||||
mode := c.mediaConfig.Mode
|
||||
var filename string
|
||||
var mediaURL string
|
||||
|
||||
// Generate filename
|
||||
ext := getExtensionFromMimeType(mimeType)
|
||||
@@ -262,23 +260,23 @@ func (c *Client) generateMediaURL(messageID, filename string) string {
|
||||
// getExtensionFromMimeType returns the file extension for a given MIME type
|
||||
func getExtensionFromMimeType(mimeType string) string {
|
||||
extensions := map[string]string{
|
||||
"image/jpeg": ".jpg",
|
||||
"image/png": ".png",
|
||||
"image/gif": ".gif",
|
||||
"image/webp": ".webp",
|
||||
"video/mp4": ".mp4",
|
||||
"video/mpeg": ".mpeg",
|
||||
"video/webm": ".webm",
|
||||
"video/3gpp": ".3gp",
|
||||
"application/pdf": ".pdf",
|
||||
"image/jpeg": ".jpg",
|
||||
"image/png": ".png",
|
||||
"image/gif": ".gif",
|
||||
"image/webp": ".webp",
|
||||
"video/mp4": ".mp4",
|
||||
"video/mpeg": ".mpeg",
|
||||
"video/webm": ".webm",
|
||||
"video/3gpp": ".3gp",
|
||||
"application/pdf": ".pdf",
|
||||
"application/msword": ".doc",
|
||||
"application/vnd.openxmlformats-officedocument.wordprocessingml.document": ".docx",
|
||||
"application/vnd.ms-excel": ".xls",
|
||||
"application/vnd.ms-excel": ".xls",
|
||||
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet": ".xlsx",
|
||||
"text/plain": ".txt",
|
||||
"text/plain": ".txt",
|
||||
"application/json": ".json",
|
||||
"audio/mpeg": ".mp3",
|
||||
"audio/ogg": ".ogg",
|
||||
"audio/mpeg": ".mp3",
|
||||
"audio/ogg": ".ogg",
|
||||
}
|
||||
|
||||
if ext, ok := extensions[mimeType]; ok {
|
||||
|
||||
Reference in New Issue
Block a user