Skip to content

Commit

Permalink
Merge pull request sparklemotion#220 from LessonPlanet/master
Browse files Browse the repository at this point in the history
Fixed handling a quoted content-disposition size parameter
  • Loading branch information
drbrain committed May 1, 2012
2 parents 0e8f0c5 + 9fbd125 commit 4e0321a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/mechanize/http/content_disposition_parser.rb
Expand Up @@ -95,7 +95,7 @@ def parse_parameters
when /^(creation|modification|read)-date$/ then
Time.rfc822 rfc_2045_quoted_string
when /^size$/ then
@scanner.scan(/\d+/).to_i(10)
rfc_2045_value.to_i(10)
else
rfc_2045_value
end
Expand Down
6 changes: 6 additions & 0 deletions test/test_mechanize_http_content_disposition_parser.rb
Expand Up @@ -52,6 +52,12 @@ def test_parse_semicolons
assert_equal 'value', content_disposition.filename
end

def test_parse_quoted_size
content_disposition = @parser.parse 'size="5"'

assert_equal 5, content_disposition.size
end

def test_rfc_2045_quoted_string
@parser.scanner = StringScanner.new '"text"'

Expand Down

0 comments on commit 4e0321a

Please sign in to comment.