Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ class SendGridEmail {

Map<String, Object> parameters = [:]

attachments.each { String filename, File attachment ->
parameters.put("files[${filename}]" as String, attachment.bytes)
attachments.each { String filename, attachment ->
parameters.put("files[${filename}]" as String, attachment instanceof byte[] ? attachment: attachment.bytes )
}

return parameters
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ class SendGridEmailBuilder {
return this
}

SendGridEmailBuilder addAttachment(String filename, File file) {
SendGridEmailBuilder addAttachment(String filename, file) {

if (filename.contains('[') || filename.contains(']')) {
throw new IllegalArgumentException('You cannot use square brackets in attachment filenames')
Expand Down