Skip to content

Commit

Permalink
Email service - send email with attachments bug fix (#8140)
Browse files Browse the repository at this point in the history
  • Loading branch information
v-vprasannak authored Oct 17, 2024
1 parent 58659c7 commit 9955b11
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 6 deletions.
4 changes: 4 additions & 0 deletions src/communication/HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
Release History
===============
1.11.1
++++++
* Fix bug in Email services - send email with attachments.

1.11.0
++++++
* Update to email SDK version to 1.0.1b1.
Expand Down
3 changes: 2 additions & 1 deletion src/communication/azext_communication/manual/_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,8 @@ def _load_email_arguments(self):
' docx, gif, jpeg, mp3, one, pdf, png, ppsm, ppsx, ppt, pptm, pptx,'
' pub, rpmsg, rtf, tif, txt, vsd, wav, wma, xls, xlsb, xlsm, and xlsx')
c.argument('inline_attachments', options_list=['--inline-attachments'], nargs='+',
help='List of inline attachments. Optional.')
help='List of inline attachments. Optional. Format: FileLocation/ContentId'
' example: "ImageName.png/image"')
c.argument('waitUntil', options_list=['--wait-until'],
arg_type=get_enum_type(['started', 'completed', '1', '0']),
help='Indicates whether to wait until the server operation is started or completed. '
Expand Down
20 changes: 16 additions & 4 deletions src/communication/azext_communication/manual/custom.py
Original file line number Diff line number Diff line change
Expand Up @@ -347,12 +347,24 @@ def prepare_attachments(attachments, attachment_types, inline_attachments):
from knack.util import CLIError

attachments_list = []

if inline_attachments is None:
inline_attachments = []

if attachments is None:
attachments = []

if attachment_types is None:
attachment_types = []

if attachments is None and attachment_types is None:
attachments_list = None
elif attachments is None or attachment_types is None:
raise CLIError('Number of attachments and attachment-types should match.')
elif (len(attachments) + len(inline_attachments)) != len(attachment_types):
raise CLIError('Number of attachments and inline attachments should match with attachment types.')
elif len(attachments) + len(inline_attachments) != len(attachment_types):
raise CLIError(
f'Mismatch: {len(attachments)} standard attachments + '
f'{len(inline_attachments)} inline attachments '
f'does not equal {len(attachment_types)} attachment types.'
)
else:
content_id = None
# Process standard attachments
Expand Down
2 changes: 1 addition & 1 deletion src/communication/azext_communication/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# --------------------------------------------------------------------------------------------


VERSION = '1.11.0'
VERSION = '1.11.1'


def cli_application_id():
Expand Down

0 comments on commit 9955b11

Please sign in to comment.