Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

explicitly check contentType of reference before downloading files #712

Merged
merged 1 commit into from
Jul 17, 2024

Conversation

lieut-data
Copy link
Member

Summary

Explicitly check for a contentType of reference before trying to process the attachment as a file attachment.

Ticket Link

Fixes: https://mattermost.atlassian.net/browse/MM-59273

@lieut-data lieut-data added this to the v2.0 milestone Jul 16, 2024
Base automatically changed from mm-59369-reduce-surface-area to main July 17, 2024 00:11
@lieut-data lieut-data force-pushed the mm-59273-improve-attachment-handling branch from ceeef26 to 85f1165 Compare July 17, 2024 00:12
@lieut-data lieut-data marked this pull request as ready for review July 17, 2024 00:14
Copy link
Member

@sbishel sbishel left a comment

Choose a reason for hiding this comment

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

LGTM, just a non-blocking personal preference.

@@ -152,6 +152,13 @@ func (ah *ActivityHandler) handleAttachments(channelID, userID, text string, msg
continue
}

// The rest of the code assumes a (file) reference: ignore other content types until we explicitly support them.
if a.ContentType != "reference" {
Copy link
Member

Choose a reason for hiding this comment

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

Suggestion for future cleanup. Move all the "ContentType" strings to constants.

@lieut-data lieut-data merged commit 745e903 into main Jul 17, 2024
9 checks passed
@lieut-data lieut-data deleted the mm-59273-improve-attachment-handling branch July 17, 2024 16:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants