remotipart
remotipart copied to clipboard
Rails 6 / 6.1 deprecation warning for #content_type
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
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.