Skip to content

Commit ac3d006

Browse files
committed
URI.encode becomes escape, not unescape
Refs. #2462
1 parent 0712435 commit ac3d006

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lib/carrierwave/uploader/download.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,8 @@ def process_uri(uri)
9292
rescue URI::InvalidURIError
9393
uri_parts = uri.split('?')
9494
# regexp from Ruby's URI::Parser#regexp[:UNSAFE], with [] specifically removed
95-
encoded_uri = URI::DEFAULT_PARSER.unescape(uri_parts.shift, /[^\-_.!~*'()a-zA-Z\d;\/?:@&=+$,]/)
96-
encoded_uri << '?' << URI::DEFAULT_PARSER.unescape(uri_parts.join('?')) if uri_parts.any?
95+
encoded_uri = URI::DEFAULT_PARSER.escape(uri_parts.shift, /[^\-_.!~*'()a-zA-Z\d;\/?:@&=+$,]/)
96+
encoded_uri << '?' << URI::DEFAULT_PARSER.escape(uri_parts.join('?')) if uri_parts.any?
9797
URI.parse(encoded_uri) rescue raise CarrierWave::DownloadError, "couldn't parse URL"
9898
end
9999

0 commit comments

Comments
 (0)