Skip to content
This repository has been archived by the owner on Nov 13, 2024. It is now read-only.

Hs/hotfix missing profile key #23

Closed
wants to merge 2 commits into from

Conversation

Half-Shot
Copy link
Member

@Half-Shot Half-Shot commented Feb 19, 2024

This is a rough fix to the problem I was seeing where we were attempting to download contact info for a contact that lacks a profile key. I'm pretty sure we should fail earlier, but this prevents it from crashing.

@Half-Shot Half-Shot changed the base branch from element-main to tadzik/user-activity-query February 19, 2024 13:50
@Half-Shot Half-Shot changed the base branch from tadzik/user-activity-query to element-main February 19, 2024 13:51
Copy link
Member

@AndrewFerr AndrewFerr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Commenting as I plan to merge this into my fuller fix

Comment on lines +270 to +272
if encryptedAvatar == nil {
return nil, fmt.Errorf("failed to read response body: encryptedAvatar was nil")
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one shouldn't be needed since decryptBytes will exit if the length of encryptedAvatar is too short, and the length of a nil slice is 0.

Comment on lines +344 to +348
if info.ProfileKey != nil {
log.Err(err).
Msg("Failed to download new user avatar, no profile key for contact")
return true
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now that the key is checked for nil in DownloadUserAvatar, this can be removed.

@Half-Shot
Copy link
Member Author

Believe superseded by #24

@Half-Shot Half-Shot closed this Feb 22, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants