Skip to content

Send and receive SMS messages using your Android phone programmatically via a simple HTTP API

Apply suggestions from code review

Acho Arnold12d6d94f52cf
diff --git a/api/pkg/validators/bulk_message_handler_validator.go b/api/pkg/validators/bulk_message_handler_validator.go
index 23b4d48d..d640c648 100644
--- a/api/pkg/validators/bulk_message_handler_validator.go
+++ b/api/pkg/validators/bulk_message_handler_validator.go
@@ -226,7 +226,14 @@ func (v *BulkMessageHandlerValidator) validateMessages(ctx context.Context, mess
if message.AttachmentURLs != "" {
urls := strings.Split(message.AttachmentURLs, ",")
- if len(urls) > 10 {
+ validAttachmentCount := 0
+ for _, u := range urls {
+ if strings.TrimSpace(u) != "" {
+ validAttachmentCount++
+ }
+ }
+
+ if validAttachmentCount > 10 {
result.Add("document", fmt.Sprintf("Row [%d]: You cannot attach more than 10 files per message.", index+2))
}
diff --git a/web/pages/threads/_id/index.vue b/web/pages/threads/_id/index.vue
index 21ff39c7..00636a0f 100644
--- a/web/pages/threads/_id/index.vue
+++ b/web/pages/threads/_id/index.vue
@@ -174,9 +174,9 @@
</v-card-text>
</v-card>
<v-card
- v-if="message.attachments"
- shaped
- >
+ v-if="message.attachments?.length"
+ shaped
+ >
<v-card-title>Message Attachments</v-card-title>
<v-card-text>
<v-row>