Compare commits

...

1 Commits

Author SHA1 Message Date
Abin Simon
1ee40fecbe Use /content instead of download link from delta 2024-01-31 09:42:33 -08:00
2 changed files with 10 additions and 13 deletions

View File

@ -366,7 +366,7 @@ func downloadContent(
itemID := ptr.Val(item.GetId())
ctx = clues.Add(ctx, "item_id", itemID)
content, err := downloadItem(ctx, iaag, item)
content, err := downloadItem(ctx, iaag, driveID, item)
if err == nil {
return content, nil
} else if !graph.IsErrUnauthorizedOrBadToken(err) {
@ -395,7 +395,7 @@ func downloadContent(
cdi := custom.ToCustomDriveItem(di)
content, err = downloadItem(ctx, iaag, cdi)
content, err = downloadItem(ctx, iaag, driveID, cdi)
if err != nil {
return nil, clues.Wrap(err, "content download retry")
}

View File

@ -11,7 +11,6 @@ import (
"github.com/alcionai/corso/src/internal/common/ptr"
"github.com/alcionai/corso/src/internal/common/readers"
"github.com/alcionai/corso/src/internal/common/str"
"github.com/alcionai/corso/src/internal/m365/collection/drive/metadata"
"github.com/alcionai/corso/src/pkg/count"
"github.com/alcionai/corso/src/pkg/logger"
@ -34,6 +33,7 @@ var downloadURLKeys = []string{
func downloadItem(
ctx context.Context,
ag api.Getter,
driveID string,
item *custom.DriveItem,
) (io.ReadCloser, error) {
if item == nil {
@ -47,17 +47,14 @@ func downloadItem(
)
if isFile {
var (
url string
ad = item.GetAdditionalData()
)
url := "https://graph.microsoft.com/v1.0/" + driveID + "/items/" + ptr.Val(item.GetId()) + "/content"
for _, key := range downloadURLKeys {
if v, err := str.AnyValueToString(key, ad); err == nil {
url = v
break
}
}
// for _, key := range downloadURLKeys {
// if v, err := str.AnyValueToString(key, ad); err == nil {
// url = v
// break
// }
// }
rc, err = downloadFile(ctx, ag, url)
if err != nil {