Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Email service - send email with attachments bug fix #8140

Merged
Merged
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
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
Loading