mirror of
https://github.com/abhinavxd/libredesk.git
synced 2025-10-23 05:11:57 +00:00
fix: allow message processing to continue on thumbnail generation errors
This commit is contained in:
@@ -842,12 +842,11 @@ func (m *Manager) uploadMessageAttachments(message *models.Message) error {
|
|||||||
return fmt.Errorf("failed to upload media %s: %w", attachment.Name, err)
|
return fmt.Errorf("failed to upload media %s: %w", attachment.Name, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
// If the attachment is an image, generate and upload thumbnail.
|
// If the attachment is an image, generate and upload a thumbnail. Log any errors and continue, as thumbnail generation failure should not block message processing.
|
||||||
attachmentExt := strings.TrimPrefix(strings.ToLower(filepath.Ext(attachment.Name)), ".")
|
attachmentExt := strings.TrimPrefix(strings.ToLower(filepath.Ext(attachment.Name)), ".")
|
||||||
if slices.Contains(image.Exts, attachmentExt) {
|
if slices.Contains(image.Exts, attachmentExt) {
|
||||||
if err := m.uploadThumbnailForMedia(media, attachment.Content); err != nil {
|
if err := m.uploadThumbnailForMedia(media, attachment.Content); err != nil {
|
||||||
m.lo.Error("error uploading thumbnail", "error", err)
|
m.lo.Error("error uploading thumbnail", "error", err)
|
||||||
return fmt.Errorf("error uploading thumbnail for media %s: %w", attachment.Name, err)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
message.Media = append(message.Media, media)
|
message.Media = append(message.Media, media)
|
||||||
|
Reference in New Issue
Block a user