Skip to content

Commit

Permalink
Remove monkey-patch in Mime::NullType
Browse files Browse the repository at this point in the history
  • Loading branch information
mayorova committed Mar 15, 2024
1 parent 96bab09 commit 2aa1981
Showing 1 changed file with 0 additions and 14 deletions.
14 changes: 0 additions & 14 deletions config/initializers/mime_types.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,3 @@

# Add new mime types for use in respond_to blocks:
# Mime::Type.register "text/richtext", :rtf

# Extracted from https://github.com/rails/rails/blob/6-1-stable/actionpack/lib/action_dispatch/http/mime_type.rb#L344-L346
# Mime::NullType has an odd behaviour in Rails 6 due to the check performed in
# https://github.com/rails/rails/blob/6-0-stable/actionpack/lib/action_controller/metal/mime_responds.rb#L208-L210
# where media_type and format are different even though both are Mime::NullType.
# The to_s method fixes the issue but, unfortunately, it was added only for Rails 6.1+.
# We may removed this patch once we upgrade Rails to 6.1.
module Mime
class NullType
def to_s
''
end
end
end

0 comments on commit 2aa1981

Please sign in to comment.