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

Skip content type filters where possible. #2464

Merged

Conversation

alexpooley
Copy link

Prior to this patch every content_type_* filter would parse magic headers via SanitizedFile#content_type,
even when the filter was not defined.

I have split the primary conditional check in to a guard clause that
simply returns unless the blacklist or whitelist returns truthy.

I've made the same changes to the extension filters for consistency.

I wanted to remove any unnecessary parse of magic headers completely on upload. This is a half measure to getting there.

Prior to this patch every content_type_* filter would parse magic headers,
even when the filter was not defined.

I have split the primary conditional check in to a guard clause that
simply returns unless the blacklist or whitelist returns truthy.

I've made the same changes to the extension filters for consistency.
@mshibuya mshibuya merged commit 39dfdcd into carrierwaveuploader:master Jan 17, 2021
@mshibuya
Copy link
Member

Thanks!

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