File tree Expand file tree Collapse file tree 2 files changed +6
-1
lines changed Expand file tree Collapse file tree 2 files changed +6
-1
lines changed Original file line number Diff line number Diff line change @@ -228,7 +228,7 @@ def unregister(symbol)
228
228
MIME_NAME = "[a-zA-Z0-9][a-zA-Z0-9#{ Regexp . escape ( '!#$&-^_.+' ) } ]{0,126}"
229
229
MIME_PARAMETER_KEY = "[a-zA-Z0-9][a-zA-Z0-9#{ Regexp . escape ( '!#$&-^_.+' ) } ]{0,126}"
230
230
MIME_PARAMETER_VALUE = "#{ Regexp . escape ( '"' ) } ?[a-zA-Z0-9][a-zA-Z0-9#{ Regexp . escape ( '!#$&-^_.+' ) } ]{0,126}#{ Regexp . escape ( '"' ) } ?"
231
- MIME_PARAMETER = "\s *\; \s + #{ MIME_PARAMETER_KEY } (?:\= #{ MIME_PARAMETER_VALUE } )?"
231
+ MIME_PARAMETER = "\s *\; \s * #{ MIME_PARAMETER_KEY } (?:\= #{ MIME_PARAMETER_VALUE } )?"
232
232
MIME_REGEXP = /\A (?:\* \/ \* |#{ MIME_NAME } \/ (?:\* |#{ MIME_NAME } )(?:\s *#{ MIME_PARAMETER } \s *)*)\z /
233
233
234
234
class InvalidMimeType < StandardError ; end
Original file line number Diff line number Diff line change @@ -194,6 +194,11 @@ class MimeTypeTest < ActiveSupport::TestCase
194
194
assert_equal 'text/html; parameter=abc; parameter2="xyz"' , Mime ::Type . new ( 'text/html; parameter=abc; parameter2="xyz"' ) . to_s
195
195
end
196
196
197
+ test "can be initialized with parameters without having space after ;" do
198
+ assert_equal "text/html;parameter" , Mime ::Type . new ( "text/html;parameter" ) . to_s
199
+ assert_equal 'text/html;parameter=abc;parameter2="xyz"' , Mime ::Type . new ( 'text/html;parameter=abc;parameter2="xyz"' ) . to_s
200
+ end
201
+
197
202
test "invalid mime types raise error" do
198
203
assert_raises Mime ::Type ::InvalidMimeType do
199
204
Mime ::Type . new ( "too/many/slash" )
You can’t perform that action at this time.
0 commit comments