Skip attachments without any content for events (#5110)
<!-- PR description--> Known issue, tracking in https://github.com/alcionai/corso/issues/4772 --- #### Does this PR need a docs update or release note? - [ ] ✅ Yes, it's included - [ ] 🕐 Yes, but in a later PR - [x] ⛔ No #### Type of change <!--- Please check the type of change your PR introduces: ---> - [ ] 🌻 Feature - [x] 🐛 Bugfix - [ ] 🗺️ Documentation - [ ] 🤖 Supportability/Tests - [ ] 💻 CI/Deployment - [ ] 🧹 Tech Debt/Cleanup #### Issue(s) <!-- Can reference multiple issues. Use one of the following "magic words" - "closes, fixes" to auto-close the Github issue. --> * #<issue> #### Test Plan <!-- How will this be tested prior to merging.--> - [ ] 💪 Manual - [ ] ⚡ Unit test - [ ] 💚 E2E
This commit is contained in:
parent
963d0e3fef
commit
c526ced23e
@ -237,15 +237,12 @@ func FromJSON(ctx context.Context, body []byte) (string, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if bytes == nil {
|
if bytes == nil {
|
||||||
// Some attachments have an "item" field instead of
|
// TODO(meain): Handle non file attachments
|
||||||
// "contentBytes". There are items like contacts, emails
|
|
||||||
// or calendar events which will not be a normal format
|
|
||||||
// and will have to be converted to a text format.
|
|
||||||
// TODO(meain): Handle custom attachments
|
|
||||||
// https://github.com/alcionai/corso/issues/4772
|
// https://github.com/alcionai/corso/issues/4772
|
||||||
logger.Ctx(ctx).
|
logger.Ctx(ctx).
|
||||||
With("attachment_id", ptr.Val(attachment.GetId())).
|
With("attachment_id", ptr.Val(attachment.GetId()),
|
||||||
Info("unhandled attachment type")
|
"attachment_type", ptr.Val(attachment.GetOdataType())).
|
||||||
|
Info("no contentBytes for attachment")
|
||||||
|
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|||||||
@ -17,6 +17,7 @@ import (
|
|||||||
"github.com/alcionai/corso/src/internal/common/ptr"
|
"github.com/alcionai/corso/src/internal/common/ptr"
|
||||||
"github.com/alcionai/corso/src/internal/common/str"
|
"github.com/alcionai/corso/src/internal/common/str"
|
||||||
"github.com/alcionai/corso/src/pkg/dttm"
|
"github.com/alcionai/corso/src/pkg/dttm"
|
||||||
|
"github.com/alcionai/corso/src/pkg/logger"
|
||||||
"github.com/alcionai/corso/src/pkg/services/m365/api"
|
"github.com/alcionai/corso/src/pkg/services/m365/api"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -527,7 +528,6 @@ func updateEventProperties(ctx context.Context, event models.Eventable, iCalEven
|
|||||||
}
|
}
|
||||||
|
|
||||||
// ATTACH - https://www.rfc-editor.org/rfc/rfc5545#section-3.8.1.1
|
// ATTACH - https://www.rfc-editor.org/rfc/rfc5545#section-3.8.1.1
|
||||||
// TODO Handle different attachment types (file, item and reference)
|
|
||||||
attachments := event.GetAttachments()
|
attachments := event.GetAttachments()
|
||||||
for _, attachment := range attachments {
|
for _, attachment := range attachments {
|
||||||
props := []ics.PropertyParameter{}
|
props := []ics.PropertyParameter{}
|
||||||
@ -548,6 +548,17 @@ func updateEventProperties(ctx context.Context, event models.Eventable, iCalEven
|
|||||||
return clues.WrapWC(ctx, err, "getting attachment content")
|
return clues.WrapWC(ctx, err, "getting attachment content")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if cb == nil {
|
||||||
|
// TODO(meain): Handle non file attachments
|
||||||
|
// https://github.com/alcionai/corso/issues/4772
|
||||||
|
logger.Ctx(ctx).
|
||||||
|
With("attachment_id", ptr.Val(attachment.GetId()),
|
||||||
|
"attachment_type", ptr.Val(attachment.GetOdataType())).
|
||||||
|
Info("no contentBytes for attachment")
|
||||||
|
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
content, ok := cb.([]uint8)
|
content, ok := cb.([]uint8)
|
||||||
if !ok {
|
if !ok {
|
||||||
return clues.NewWC(ctx, "getting attachment content string").
|
return clues.NewWC(ctx, "getting attachment content string").
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user