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

Rails 6 / 6.1 deprecation warning for #content_type #208

Open
shepmaster opened this issue Feb 11, 2020 · 1 comment
Open

Rails 6 / 6.1 deprecation warning for #content_type #208

shepmaster opened this issue Feb 11, 2020 · 1 comment

Comments

@shepmaster
Copy link

DEPRECATION WARNING: Rails 6.1 will return Content-Type header without modification. If you want just the MIME type, please use #media_type instead.

gems/remotipart-1.4.4/lib/remotipart/render_overrides.rb:37:in `treat_render_for_remotipart'
gems/remotipart-1.4.4/lib/remotipart/render_overrides.rb:23:in `render'

https://github.com/JangoSteve/remotipart/blob/v1.4.4/lib/remotipart/render_overrides.rb#L37

@lacco
Copy link

lacco commented Dec 3, 2021

I did some basic investigation on that and came to the conclusion that the deprecation warning can be ignored.

After setting the following configuration, file uploads continued to work:

Rails.application.config.action_dispatch.return_only_media_type_on_content_type = false
ActionDispatch::Response.return_only_media_type_on_content_type = false

I believe the reason for this can be found in jquery.iframe-transport.js: https://github.com/JangoSteve/remotipart/blob/master/vendor/assets/javascripts/jquery.iframe-transport.js#L222
The content_type from the textarea is simply passed to jQuery as Content-Type.
jQuery seems to be able to handle any extra ; charset=utf-8 information.

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

No branches or pull requests

2 participants