From 844dcae9b6c351e8688f7e9536c400053b313ae6 Mon Sep 17 00:00:00 2001 From: Danny Date: Thu, 2 Feb 2023 12:22:04 -0500 Subject: [PATCH] GC: Logging: Expand `ItemAttachment` object details for coverage (#2366) ## Description Updates within /internal/connector/exchange package. Adds helper function for displaying the internal object item type that is included as an attachment. This will help overall with supporting additional `ItemAttachment` objects. ## Does this PR need a docs update or release note? - [x] :no_entry: No ## Type of change - [x] :broom: Tech Debt/Cleanup ## Issue(s) * related to #2353 ## Test Plan - [x] :muscle: Manual --- src/internal/connector/exchange/attachment.go | 24 ++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/src/internal/connector/exchange/attachment.go b/src/internal/connector/exchange/attachment.go index 5b6334e21..6ed05b5df 100644 --- a/src/internal/connector/exchange/attachment.go +++ b/src/internal/connector/exchange/attachment.go @@ -55,9 +55,15 @@ func uploadAttachment( // item Attachments to be skipped until the completion of Issue #2353 if attachmentType == models.ITEM_ATTACHMENTTYPE { + name := "" + if attachment.GetName() != nil { + name = *attachment.GetName() + } + logger.Ctx(ctx).Infow("item attachment uploads are not supported ", - "attachment_name", *attachment.GetName(), // TODO: Update to support PII protection + "attachment_name", name, // TODO: Update to support PII protection "attachment_type", attachmentType, + "internal_item_type", getItemAttachmentItemType(attachment), "attachment_id", *attachment.GetId(), ) @@ -101,3 +107,19 @@ func uploadLargeAttachment(ctx context.Context, uploader attachmentUploadable, return nil } + +func getItemAttachmentItemType(query models.Attachmentable) string { + empty := "" + attachment, ok := query.(models.ItemAttachmentable) + + if !ok { + return empty + } + + item := attachment.GetItem() + if item.GetOdataType() == nil { + return empty + } + + return *item.GetOdataType() +}