aboutsummaryrefslogtreecommitdiffstats
path: root/lib/open-uri.rb
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-09-13 02:29:47 +0000
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-09-13 02:29:47 +0000
commit0cde80d36a498655f3a6cdc792130e7f39fbe776 (patch)
treeb17783b694c3f99eefec78468e6447a502e0c8d0 /lib/open-uri.rb
parenta8998030fbabc0f604f82350a0767002a86f6068 (diff)
downloadruby-0cde80d36a498655f3a6cdc792130e7f39fbe776.tar.gz
* lib/open-uri.rb (OpenURI::Meta#content_type_parse): strip quotes.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24885 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/open-uri.rb')
-rw-r--r--lib/open-uri.rb4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/open-uri.rb b/lib/open-uri.rb
index b426455e27..406a388e5b 100644
--- a/lib/open-uri.rb
+++ b/lib/open-uri.rb
@@ -465,7 +465,9 @@ module OpenURI
subtype = $2.downcase
parameters = []
$3.scan(/;#{RE_LWS}?(#{RE_TOKEN})#{RE_LWS}?=#{RE_LWS}?(?:(#{RE_TOKEN})|(#{RE_QUOTED_STRING}))/no) {|att, val, qval|
- val = qval.gsub(/[\r\n\t !#-\[\]-~\x80-\xff]+|(\\[\x00-\x7f])/n) { $1 ? $1[1,1] : $& } if qval
+ if qval
+ val = qval[1...-1].gsub(/[\r\n\t !#-\[\]-~\x80-\xff]+|(\\[\x00-\x7f])/n) { $1 ? $1[1,1] : $& }
+ end
parameters << [att.downcase, val]
}
["#{type}/#{subtype}", *parameters]