Actions
Bug #1932
openAn ActionDispatch::Http::MimeNegotiation::InvalidType occurred in welcome#index
Start date:
Due date:
% Done:
0%
Estimated time:
Affected Version:
Compatible Redmine Version:
Pull Request Link:
Description
Excerpt from the error and backtrace:
ActionView::Template::Error: <diverse-strings-with-characters> is not a valid MIME type
/path/shared/bundle/ruby/3.1.0/gems/actionpack-6.1.7.6/lib/action_dispatch/http/mime_negotiation.rb:31:in `rescue in block in content_mime_type'
/path/shared/bundle/ruby/3.1.0/gems/actionpack-6.1.7.6/lib/action_dispatch/http/mime_negotiation.rb:24:in `block in content_mime_type'
/path/shared/bundle/ruby/3.1.0/gems/rack-2.2.8/lib/rack/request.rb:69:in `fetch'
/path/shared/bundle/ruby/3.1.0/gems/rack-2.2.8/lib/rack/request.rb:69:in `fetch_header'
/path/shared/bundle/ruby/3.1.0/gems/actionpack-6.1.7.6/lib/action_dispatch/http/mime_negotiation.rb:23:in `content_mime_type'
/path/shared/bundle/ruby/3.1.0/gems/actionpack-6.1.7.6/lib/action_dispatch/http/request.rb:269:in `media_type'
/path/shared/bundle/ruby/3.1.0/gems/actionpack-6.1.7.6/lib/action_dispatch/http/request.rb:355:in `form_data?'
/path/shared/bundle/ruby/3.1.0/gems/rack-2.2.8/lib/rack/request.rb:445:in `POST'
/path/shared/bundle/ruby/3.1.0/gems/actionpack-6.1.7.6/lib/action_dispatch/http/request.rb:400:in `block (2 levels) in POST'
/path/shared/bundle/ruby/3.1.0/gems/actionpack-6.1.7.6/lib/action_dispatch/http/parameters.rb:88:in `parse_formatted_parameters'
/path/shared/bundle/ruby/3.1.0/gems/actionpack-6.1.7.6/lib/action_dispatch/http/request.rb:399:in `block in POST'
/path/shared/bundle/ruby/3.1.0/gems/rack-2.2.8/lib/rack/request.rb:69:in `fetch'
/path/shared/bundle/ruby/3.1.0/gems/rack-2.2.8/lib/rack/request.rb:69:in `fetch_header'
/path/shared/bundle/ruby/3.1.0/gems/actionpack-6.1.7.6/lib/action_dispatch/http/request.rb:398:in `POST'
# Examples for <diverse-strings-with-characters>
"%{#context['com.opensymphony.xwork2.dispatcher.httpservletresponse'].addheader('x-tenable'"
"${jndi:ldap://127.0.0.1#log4shell-generic-iV06hYVdJen6hJRK5n3U.w.nessus.org/nessus}"
"%{(#_='multipart/form-data').(#dm=@ognl.ognlcontext@default_member_access).(#_memberaccess?(#_memberaccess=#dm):((#container=#context['com.opensymphony.xwork2.actioncontext.container']).(#ognlutil=#container.getinstance(@com.opensymphony.xwork2.ognl.ognlutil@class)).(#ognlutil.getexcludedpackagenames().clear()).(#ognlutil.getexcludedclasses().clear()).(#context.setmemberaccess(#dm)))).(#iswin=(@java.lang.system@getproperty('os.name').tolowercase().contains('win'))).(#cmds=(#iswin?{'cmd.exe'"
Ruby method ActionDispatch::Http::MimeNegotiation#content_mime_type
:
# File actionpack/lib/action_dispatch/http/mime_negotiation.rb, line 36
def content_mime_type
fetch_header("action_dispatch.request.content_type") do |k|
v = if get_header("CONTENT_TYPE") =~ /^([^,;]*)/
Mime::Type.lookup($1.strip.downcase)
else
nil
end
set_header k, v
rescue ::Mime::Type::InvalidMimeType => e
raise InvalidType, e.message
end
end
Updated by liaham about 1 year ago
- Description updated (diff)
Could be helpful:
- https://stackoverflow.com/questions/70695605/is-not-a-valid-mime-type
- https://stackoverflow.com/questions/69753130/exception-actiondispatchhttpmimenegotiationinvalidtype
- https://github.com/rails/rails/issues/43094
Seemed to be fixed in Rails 7:
https://github.com/rails/rails/commit/30e54b8622de13e1ef9691acf89f8180bd833eb5
Updated by liaham about 1 year ago
- Project changed from xmera Omnia to Redmine Dashboards
- Target version changed from 4.3.0 to unreleased
- Affected component deleted (
redmine-dashboards) - Affected Version deleted (
4.2.1)
Actions