diff --git a/src/internal/connector/exchange/restore_test.go b/src/internal/connector/exchange/restore_test.go index 78892f361..714847736 100644 --- a/src/internal/connector/exchange/restore_test.go +++ b/src/internal/connector/exchange/restore_test.go @@ -227,36 +227,38 @@ func (suite *RestoreIntgSuite) TestRestoreExchangeObject() { return ptr.Val(folder.GetId()) }, }, - { - name: "Test Mail: Hydrated Item Attachment Mail", - bytes: exchMock.MessageWithNestedItemAttachmentMail(t, - exchMock.MessageBytes("Basic Item Attachment"), - "Mail Item Attachment", - ), - category: path.EmailCategory, - destination: func(t *testing.T, ctx context.Context) string { - folderName := tester.DefaultTestRestoreDestination("mailbasicattch").ContainerName - folder, err := suite.ac.Mail().CreateMailFolder(ctx, userID, folderName) - require.NoError(t, err, clues.ToCore(err)) - return ptr.Val(folder.GetId()) - }, - }, - { - name: "Test Mail: Hydrated Item Attachment Mail One Attach", - bytes: exchMock.MessageWithNestedItemAttachmentMail(t, - exchMock.MessageWithDirectAttachment("Item Attachment Included"), - "Mail Item Attachment", - ), - category: path.EmailCategory, - destination: func(t *testing.T, ctx context.Context) string { - folderName := tester.DefaultTestRestoreDestination("mailnestattch").ContainerName - folder, err := suite.ac.Mail().CreateMailFolder(ctx, userID, folderName) - require.NoError(t, err, clues.ToCore(err)) + //TODO: Neha complete as part of https://github.com/alcionai/corso/issues/2428 + // { + // name: "Test Mail: Hydrated Item Attachment Mail", + // bytes: exchMock.MessageWithNestedItemAttachmentMail(t, + // exchMock.MessageBytes("Basic Item Attachment"), + // "Mail Item Attachment", + // ), + // category: path.EmailCategory, + // destination: func(t *testing.T, ctx context.Context) string { + // folderName := tester.DefaultTestRestoreDestination("mailbasicattch").ContainerName + // folder, err := suite.ac.Mail().CreateMailFolder(ctx, userID, folderName) + // require.NoError(t, err, clues.ToCore(err)) - return ptr.Val(folder.GetId()) - }, - }, + // return ptr.Val(folder.GetId()) + // }, + // }, + // { + // name: "Test Mail: Hydrated Item Attachment Mail One Attach", + // bytes: exchMock.MessageWithNestedItemAttachmentMail(t, + // exchMock.MessageWithDirectAttachment("Item Attachment Included"), + // "Mail Item Attachment", + // ), + // category: path.EmailCategory, + // destination: func(t *testing.T, ctx context.Context) string { + // folderName := tester.DefaultTestRestoreDestination("mailnestattch").ContainerName + // folder, err := suite.ac.Mail().CreateMailFolder(ctx, userID, folderName) + // require.NoError(t, err, clues.ToCore(err)) + + // return ptr.Val(folder.GetId()) + // }, + // }, { name: "Test Mail: Item Attachment_Contact", bytes: exchMock.MessageWithNestedItemAttachmentContact(t, diff --git a/src/internal/connector/exchange/service_restore.go b/src/internal/connector/exchange/service_restore.go index f5435249e..32ba73535 100644 --- a/src/internal/connector/exchange/service_restore.go +++ b/src/internal/connector/exchange/service_restore.go @@ -228,18 +228,6 @@ func RestoreMessage( ptr.Val(item.GetId()), a) if err != nil { - // FIXME: I don't know why we're swallowing this error case. - // It needs investigation: https://github.com/alcionai/corso/issues/3498 - if ptr.Val(a.GetOdataType()) == "#microsoft.graph.itemAttachment" { - name := ptr.Val(a.GetName()) - - logger.CtxErr(ctx, err). - With("attachment_name", name). - Info("mail upload failed") - - continue - } - el.AddRecoverable(clues.Wrap(err, "uploading mail attachment")) } } diff --git a/src/internal/connector/exchange/transform.go b/src/internal/connector/exchange/transform.go index 99df1805c..f41775093 100644 --- a/src/internal/connector/exchange/transform.go +++ b/src/internal/connector/exchange/transform.go @@ -2,6 +2,7 @@ package exchange import ( "fmt" + "reflect" "strings" "github.com/alcionai/clues" @@ -264,7 +265,11 @@ func sanitizeEvent(orig models.Eventable) (models.Eventable, error) { newEvent.SetImportance(orig.GetImportance()) newEvent.SetIsAllDay(orig.GetIsAllDay()) newEvent.SetIsOnlineMeeting(orig.GetIsOnlineMeeting()) - newEvent.SetLocation(orig.GetLocation()) + + if !isNil(orig.GetLocation()) { + newEvent.SetLocation(orig.GetLocation()) + } + newEvent.SetLocations(orig.GetLocations()) newEvent.SetSensitivity(orig.GetSensitivity()) newEvent.SetReminderMinutesBeforeStart(orig.GetReminderMinutesBeforeStart()) @@ -292,6 +297,19 @@ func sanitizeEvent(orig models.Eventable) (models.Eventable, error) { return newEvent, nil } +func isNil(i interface{}) bool { + if i == nil { + return true + } + + switch reflect.TypeOf(i).Kind() { + case reflect.Ptr, reflect.Map, reflect.Array, reflect.Chan, reflect.Slice: + return reflect.ValueOf(i).IsNil() + } + + return false +} + func sanitizeMessage(orig models.Messageable) (models.Messageable, error) { message := toMessage(orig)