Skip to content

Commit

Permalink
Merge pull request #28 from lawmurray/master
Browse files Browse the repository at this point in the history
Save an API request by using XAttr in the Link object
  • Loading branch information
henrybear327 authored Nov 19, 2024
2 parents 2172bb8 + a6d0537 commit 08abccb
Showing 1 changed file with 4 additions and 10 deletions.
14 changes: 4 additions & 10 deletions file.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,25 +49,19 @@ func (protonDrive *ProtonDrive) GetActiveRevisionAttrs(ctx context.Context, link
return nil, ErrLinkMustNotBeNil
}

revisionsMetadata, err := protonDrive.GetRevisions(ctx, link, proton.RevisionStateActive)
if err != nil {
return nil, err
}

if len(revisionsMetadata) != 1 {
return nil, ErrCantFindActiveRevision
}
revisionMetadata := link.FileProperties.ActiveRevision
revisionMetadata.XAttr = link.XAttr

Check failure on line 53 in file.go

View workflow job for this annotation

GitHub Actions / check

link.XAttr undefined (type *proton.Link has no field or method XAttr) (typecheck)

nodeKR, err := protonDrive.getLinkKR(ctx, link)
if err != nil {
return nil, err
}

signatureVerificationKR, err := protonDrive.getSignatureVerificationKeyring([]string{link.FileProperties.ActiveRevision.SignatureEmail})
signatureVerificationKR, err := protonDrive.getSignatureVerificationKeyring([]string{revisionMetadata.SignatureEmail})
if err != nil {
return nil, err
}
revisionXAttrCommon, err := revisionsMetadata[0].GetDecXAttrString(signatureVerificationKR, nodeKR)
revisionXAttrCommon, err := revisionMetadata.GetDecXAttrString(signatureVerificationKR, nodeKR)
if err != nil {
return nil, err
}
Expand Down

0 comments on commit 08abccb

Please sign in to comment.