Compare commits
4 Commits
main
...
itemAttach
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3d8f9e40ab | ||
|
|
e739ef5d4f | ||
|
|
1ec8995f7f | ||
|
|
eb3b9a88c8 |
@ -1,6 +1,9 @@
|
|||||||
package ptr
|
package ptr
|
||||||
|
|
||||||
import "time"
|
import (
|
||||||
|
"reflect"
|
||||||
|
"time"
|
||||||
|
)
|
||||||
|
|
||||||
// ptr package is a common package used for pointer
|
// ptr package is a common package used for pointer
|
||||||
// access and deserialization.
|
// access and deserialization.
|
||||||
@ -50,3 +53,17 @@ func OrNow(t *time.Time) time.Time {
|
|||||||
func To[T any](t T) *T {
|
func To[T any](t T) *T {
|
||||||
return &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())
|
return ptr.Val(folder.GetId())
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
// TODO: Neha complete as part of https://github.com/alcionai/corso/issues/2428
|
||||||
name: "Test Mail: Hydrated Item Attachment Mail",
|
// {
|
||||||
bytes: exchMock.MessageWithNestedItemAttachmentMail(t,
|
// name: "Test Mail: Hydrated Item Attachment Mail",
|
||||||
exchMock.MessageBytes("Basic Item Attachment"),
|
// bytes: exchMock.MessageWithNestedItemAttachmentMail(t,
|
||||||
"Mail Item Attachment",
|
// exchMock.MessageBytes("Basic Item Attachment"),
|
||||||
),
|
// "Mail Item Attachment",
|
||||||
category: path.EmailCategory,
|
// ),
|
||||||
destination: func(t *testing.T, ctx context.Context) string {
|
// category: path.EmailCategory,
|
||||||
folderName := tester.DefaultTestRestoreDestination("mailbasicattch").ContainerName
|
// destination: func(t *testing.T, ctx context.Context) string {
|
||||||
folder, err := handlers[path.EmailCategory].
|
// folderName := tester.DefaultTestRestoreDestination("mailbasicattch").ContainerName
|
||||||
CreateContainer(ctx, userID, folderName, "")
|
// folder, err := handlers[path.EmailCategory].
|
||||||
require.NoError(t, err, clues.ToCore(err))
|
// CreateContainer(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",
|
// name: "Test Mail: Hydrated Item Attachment Mail One Attach",
|
||||||
bytes: exchMock.MessageWithNestedItemAttachmentMail(t,
|
// bytes: exchMock.MessageWithNestedItemAttachmentMail(t,
|
||||||
exchMock.MessageWithDirectAttachment("Item Attachment Included"),
|
// exchMock.MessageWithDirectAttachment("Item Attachment Included"),
|
||||||
"Mail Item Attachment",
|
// "Mail Item Attachment",
|
||||||
),
|
// ),
|
||||||
category: path.EmailCategory,
|
// category: path.EmailCategory,
|
||||||
destination: func(t *testing.T, ctx context.Context) string {
|
// destination: func(t *testing.T, ctx context.Context) string {
|
||||||
folderName := tester.DefaultTestRestoreDestination("mailnestattch").ContainerName
|
// folderName := tester.DefaultTestRestoreDestination("mailnestattch").ContainerName
|
||||||
folder, err := handlers[path.EmailCategory].
|
// folder, err := handlers[path.EmailCategory].
|
||||||
CreateContainer(ctx, userID, folderName, "")
|
// CreateContainer(ctx, userID, folderName, "")
|
||||||
require.NoError(t, err, clues.ToCore(err))
|
// require.NoError(t, err, clues.ToCore(err))
|
||||||
|
|
||||||
return ptr.Val(folder.GetId())
|
// return ptr.Val(folder.GetId())
|
||||||
},
|
// },
|
||||||
},
|
// },
|
||||||
{
|
{
|
||||||
name: "Test Mail: Item Attachment_Contact",
|
name: "Test Mail: Item Attachment_Contact",
|
||||||
bytes: exchMock.MessageWithNestedItemAttachmentContact(t,
|
bytes: exchMock.MessageWithNestedItemAttachmentContact(t,
|
||||||
|
|||||||
@ -334,18 +334,6 @@ func uploadAttachments(
|
|||||||
itemID,
|
itemID,
|
||||||
a)
|
a)
|
||||||
if err != nil {
|
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))
|
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.SetImportance(orig.GetImportance())
|
||||||
newEvent.SetIsAllDay(orig.GetIsAllDay())
|
newEvent.SetIsAllDay(orig.GetIsAllDay())
|
||||||
newEvent.SetIsOnlineMeeting(orig.GetIsOnlineMeeting())
|
newEvent.SetIsOnlineMeeting(orig.GetIsOnlineMeeting())
|
||||||
newEvent.SetLocation(orig.GetLocation())
|
|
||||||
|
if !ptr.IsNil(orig.GetLocation()) {
|
||||||
|
newEvent.SetLocation(orig.GetLocation())
|
||||||
|
}
|
||||||
|
|
||||||
newEvent.SetLocations(orig.GetLocations())
|
newEvent.SetLocations(orig.GetLocations())
|
||||||
newEvent.SetSensitivity(orig.GetSensitivity())
|
newEvent.SetSensitivity(orig.GetSensitivity())
|
||||||
newEvent.SetReminderMinutesBeforeStart(orig.GetReminderMinutesBeforeStart())
|
newEvent.SetReminderMinutesBeforeStart(orig.GetReminderMinutesBeforeStart())
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user