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

Check the mimetype, not the whole Content-Type header on media download #51

Merged
merged 2 commits into from
Dec 11, 2020

Conversation

anoadragon453
Copy link
Member

Fixes #49

By checking just the mimetype instead of an exact string match, homeservers are allowed to add charsets and other directives if they choose. As long as the mimetype stays the same, we're happy.

A comment on the original issue states that the spec is a bit vague about this, and that ideally it would be more explicit about what should happen here. At the moment though this is all we're going to test as it matches the expected behaviour from homeservers.

cc @turt2live


// Check the Content-Type response header.
// Homeservers are free to add other directives. All we want to check is the mimetype.
mimeType := strings.Split(ct, ";")[0]
Copy link
Member

Choose a reason for hiding this comment

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

Please add NOTSPEC: and explain the ambiguities that @turt2live pointed out.

Copy link
Member Author

Choose a reason for hiding this comment

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

Oh ok. Should we add this wording to ONBOARDING.md or similar to standardise it?

@anoadragon453 anoadragon453 merged commit 1b6116f into master Dec 11, 2020
@anoadragon453 anoadragon453 deleted the anoa/mimetype_checks branch December 11, 2020 12: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.

TestMediaWithoutFileName test does not allow changes in content type between media upload and download
2 participants