Skip to content
Browse files

Do not handle any special cases for URL handling, keep the existing e…

…scape/unescape functionality and allow overriding, closes #773
  • Loading branch information...
1 parent 86a2ff7 commit a95e5daf6ed7c63a9620effe533d1ff61f2e916f @bensie bensie committed May 31, 2012
Showing with 1 addition and 13 deletions.
  1. +1 −1 lib/carrierwave/uploader/download.rb
  2. +0 −12 spec/uploader/download_spec.rb
View
2 lib/carrierwave/uploader/download.rb
@@ -70,7 +70,7 @@ def download!(uri)
# [url (String)] The URL where the remote file is stored
#
def process_uri(uri)
- URI.parse(URI.escape(URI.unescape(uri)).gsub("[", "%5B").gsub("]", "%5D").gsub("+", "%2B"))
+ URI.parse(URI.escape(URI.unescape(uri)))
end
end # Download
View
12 spec/uploader/download_spec.rb
@@ -21,8 +21,6 @@
sham_rack_app = ShamRack.at('www.example.com').stub
sham_rack_app.register_resource('/test.jpg', File.read(file_path('test.jpg')), 'image/jpg')
sham_rack_app.register_resource('/test%20with%20spaces/test.jpg', File.read(file_path('test.jpg')), 'image/jpg')
- sham_rack_app.register_resource('/test-with-brackets/test-%5B4%5D.jpg', File.read(file_path('test.jpg')), 'image/jpg')
- sham_rack_app.register_resource('/test-with-params/test.jpg?param=foo%2Bbar', File.read(file_path('test.jpg')), 'image/jpg')
ShamRack.at("www.redirect.com") do |env|
[301, {'Content-Type'=>'text/html', 'Location'=>"http://www.example.com/test.jpg"}, ['Redirecting']]
@@ -99,16 +97,6 @@
@uploader.url.should == '/uploads/tmp/20071201-1234-345-2255/test.jpg'
end
- it "should accept brackets in the url" do
- @uploader.download!('http://www.example.com/test-with-brackets/test-[4].jpg')
- @uploader.url.should == '/uploads/tmp/20071201-1234-345-2255/test-_5B4_5D.jpg'
- end
-
- it "should escape plusses in the url params" do
- @uploader.download!('http://www.example.com/test-with-params/test.jpg?param=foo+bar')
- @uploader.url.should == '/uploads/tmp/20071201-1234-345-2255/test.jpg'
- end
-
it "should follow redirects" do
@uploader.download!('http://www.redirect.com/')
@uploader.url.should == '/uploads/tmp/20071201-1234-345-2255/test.jpg'

0 comments on commit a95e5da

Please sign in to comment.
Something went wrong with that request. Please try again.