lib/carrierwave/uploader/download.rb in carrierwave-0.6.2 vs lib/carrierwave/uploader/download.rb in carrierwave-0.7.0
- old
+ new
@@ -34,10 +34,13 @@
if @file.blank?
@file = Kernel.open(@uri.to_s)
@file = @file.is_a?(String) ? StringIO.new(@file) : @file
end
@file
+
+ rescue
+ raise CarrierWave::DownloadError, "could not download file"
end
def method_missing(*args, &block)
file.send(*args, &block)
end
@@ -65,10 +68,10 @@
# === Parameters
#
# [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
end # Uploader
end # CarrierWave