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

Remove check of matching claimed and detected MIME type #60

Merged
merged 1 commit into from
Jul 25, 2024

Conversation

MatMaul
Copy link
Contributor

@MatMaul MatMaul commented Jun 24, 2024

It seems not necessary since we already check allowed MIME types against the detected type and not the claimed one.

It leads to quite a bunch of false positives since a lot of clients have trouble properly detecting the type.

It is not necessary since we already check allowed MIME types
against the detected type and not the claimed one.

It leads to quite a bunch of false positives since a lot of clients
have trouble properly detecting the type.
@anoadragon453 anoadragon453 requested a review from a team July 24, 2024 08:47
Copy link
Member

@devonh devonh left a comment

Choose a reason for hiding this comment

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

Agreed that the check is unnecessary and only leads to increased false positives.

Thanks for this!

is always 'application/octet-stream')
* files with this MIME type are allowed (if an allow list is provided in the
configuration)
def _check_mimetype(self,media_content: bytes) -> None:
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
def _check_mimetype(self,media_content: bytes) -> None:
def _check_mimetype(self, media_content: bytes) -> None:

Copy link
Member

Choose a reason for hiding this comment

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

This should fix the linter error.

Copy link
Member

@devonh devonh left a comment

Choose a reason for hiding this comment

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

I guess I shouldn't have approved just yet until the linter error is fixed.
Want to make sure the issue doesn't slip off your radar since I can't push the fix to your fork.

@devonh devonh merged commit 0bffb9e into element-hq:main Jul 25, 2024
3 of 4 checks passed
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.

2 participants