summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog4
-rw-r--r--lib/open-uri.rb4
2 files changed, 7 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 850059b3f8..6fb2bf3c55 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+Sun Sep 13 11:06:12 2009 Tanaka Akira <akr@fsij.org>
+
+ * lib/open-uri.rb (OpenURI::Meta#content_type_parse): strip quotes.
+
Sun Sep 13 01:55:32 2009 Tanaka Akira <akr@fsij.org>
* lib/open-uri.rb (URI::FTP#buffer_open): fix the %2F handling.
diff --git a/lib/open-uri.rb b/lib/open-uri.rb
index 73f10b356c..69982ec70c 100644
--- a/lib/open-uri.rb
+++ b/lib/open-uri.rb
@@ -435,7 +435,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]