Compare commits
4 Commits
main
...
itemAttach
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3d8f9e40ab | ||
|
|
e739ef5d4f | ||
|
|
1ec8995f7f | ||
|
|
eb3b9a88c8 |
@ -1,6 +1,9 @@
|
||||
package ptr
|
||||
|
||||
import "time"
|
||||
import (
|
||||
"reflect"
|
||||
"time"
|
||||
)
|
||||
|
||||
// ptr package is a common package used for pointer
|
||||
// access and deserialization.
|
||||
@ -50,3 +53,17 @@ func OrNow(t *time.Time) time.Time {
|
||||
func To[T any](t T) *T {
|
||||
return &t
|
||||
}
|
||||
|
||||
// IsNil check if type provided is nil
|
||||
func IsNil(i any) 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
|
||||
}
|
||||
|
||||
@ -211,38 +211,39 @@ 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 := handlers[path.EmailCategory].
|
||||
CreateContainer(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 := handlers[path.EmailCategory].
|
||||
// CreateContainer(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 := handlers[path.EmailCategory].
|
||||
CreateContainer(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 := handlers[path.EmailCategory].
|
||||
// CreateContainer(ctx, userID, folderName, "")
|
||||
// require.NoError(t, err, clues.ToCore(err))
|
||||
|
||||
return ptr.Val(folder.GetId())
|
||||
},
|
||||
},
|
||||
// return ptr.Val(folder.GetId())
|
||||
// },
|
||||
// },
|
||||
{
|
||||
name: "Test Mail: Item Attachment_Contact",
|
||||
bytes: exchMock.MessageWithNestedItemAttachmentContact(t,
|
||||
|
||||
@ -334,18 +334,6 @@ func uploadAttachments(
|
||||
itemID,
|
||||
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").WithClues(ctx))
|
||||
}
|
||||
}
|
||||
|
||||
@ -257,7 +257,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 !ptr.IsNil(orig.GetLocation()) {
|
||||
newEvent.SetLocation(orig.GetLocation())
|
||||
}
|
||||
|
||||
newEvent.SetLocations(orig.GetLocations())
|
||||
newEvent.SetSensitivity(orig.GetSensitivity())
|
||||
newEvent.SetReminderMinutesBeforeStart(orig.GetReminderMinutesBeforeStart())
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user