Update for troubleshooting.

This commit is contained in:
Danny Adams 2023-02-01 21:59:08 -05:00
parent c5a36665e5
commit 2a426f17a1

View File

@ -3,11 +3,13 @@ package exchange
import ( import (
"bytes" "bytes"
"context" "context"
"fmt"
"io" "io"
"github.com/microsoftgraph/msgraph-sdk-go/models" "github.com/microsoftgraph/msgraph-sdk-go/models"
"github.com/pkg/errors" "github.com/pkg/errors"
"github.com/alcionai/corso/src/internal/connector/support"
"github.com/alcionai/corso/src/internal/connector/uploadsession" "github.com/alcionai/corso/src/internal/connector/uploadsession"
"github.com/alcionai/corso/src/pkg/logger" "github.com/alcionai/corso/src/pkg/logger"
) )
@ -55,14 +57,19 @@ func uploadAttachment(
// item Attachments to be skipped until the completion of Issue #2353 // item Attachments to be skipped until the completion of Issue #2353
if attachmentType == models.ITEM_ATTACHMENTTYPE { if attachmentType == models.ITEM_ATTACHMENTTYPE {
attachment, err := support.ToItemAttachment(attachment)
if err != nil {
logger.Ctx(ctx).Infow("item attachment uploads are not supported ", logger.Ctx(ctx).Infow("item attachment uploads are not supported ",
"attachment_name", *attachment.GetName(), // TODO: Update to support PII protection "attachment_name", *attachment.GetName(), // TODO: Update to support PII protection
"attachment_type", attachmentType, "attachment_type", attachmentType,
"attachment_id", *attachment.GetId(), "attachment_id", *attachment.GetId(),
) )
fmt.Println("Error returned: " + err.Error())
return nil return nil
} }
}
// For Item/Reference attachments *or* file attachments < 3MB, use the attachments endpoint // For Item/Reference attachments *or* file attachments < 3MB, use the attachments endpoint
if attachmentType != models.FILE_ATTACHMENTTYPE || *attachment.GetSize() < largeAttachmentSize { if attachmentType != models.FILE_ATTACHMENTTYPE || *attachment.GetSize() < largeAttachmentSize {