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

Improve content type detection for .dotx, .ai, and others. #2705

Merged

Conversation

dzhikvas
Copy link
Contributor

@dzhikvas dzhikvas commented Sep 12, 2023

To correctly detect content type of file in some cases file extension should be used in addition to magic detection. Such cases include custom extensions with .zip contents, .dotx / .docx files which have same magic signature, and others.

This approach keeps protection from spoofing intact, which would not be guaranteed if Marcel::MimeType.for were used.

This should also resolve issues described in #2704

To correctly detect content type of file in some cases file
extension should be used in addition to magic detection.
Such cases include custom extensions with .zip contents,
.dotx / .docx files which have same magic signature.
@dzhikvas dzhikvas changed the title Improve content type detection for .dotx and .ai Improve content type detection for .dotx, .ai, and others. Sep 12, 2023
@mshibuya mshibuya merged commit 20c6d75 into carrierwaveuploader:master Dec 3, 2023
13 checks passed
@mshibuya
Copy link
Member

mshibuya commented Dec 3, 2023

Amazing work, thank you!

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.

None yet

2 participants