Skip to content

Rails ignoring provided content-type parameters other than charset #35709

@McPolemic

Description

@McPolemic

Steps to reproduce

In a controller, render something with a specified content-type:

render body: "test content",
       content_type: "text/html; sandwiches=tasty; charset=utf-8; birds=flying"

See https://gist.github.com/85892fccc12d05d60c3d60c76c14500e for a single-file reproduction or https://github.com/leequarella/content-type-rails-bug for a rails app reproducing the problem.

Expected behavior

It includes all key/value pairs sandwiches=tasty and birds=flying in the Content-Type header returned to the browser.

Actual behavior

It strips out all key/value pairs and returns a content-type of `text/html; charset=utf-8" to the browser.

System configuration

Rails version:
Current master (4c8a333)

Ruby version:
2.5.1

Related PRs

#35549 - This seems to have started the behavior when it fixed certain issues with the character set portion of the content-type
#35706 - This fixed the issue in Rails 5.2 but not Rails 6.0

/cc @leequarella, @cpruitt, @jhawthorn

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions