Sha256: d00d70b40ac55b6fba4934995eb68c273b5183c424166e01f055b6d07ad87721

Contents?: true

Size: 740 Bytes

Versions: 53

Compression:

Stored size: 740 Bytes

Contents

module Cloudinary::CarrierWave
  def download!(uri)
    return super if !self.cloudinary_should_handle_remote?
    if respond_to?(:process_uri)
      uri = process_uri(uri)
    else # Backward compatibility with old CarrierWave
      uri = URI.parse(URI.escape(URI.unescape(uri)))
    end
    return if uri.to_s.blank?
    self.original_filename = @cache_id = @filename = File.basename(uri.path).gsub(/[^a-zA-Z0-9\.\-\+_]/, '')
    @file = RemoteFile.new(uri, @filename)
  end

  class RemoteFile
    attr_reader :uri, :original_filename
    def initialize(uri, filename)
      @uri = uri
      @original_filename = filename
    end
    
    def delete
      # Do nothing. This is a virtual file.
    end
  end
end  

Version data entries

53 entries across 53 versions & 1 rubygems

Version Path
cloudinary-1.0.80 lib/cloudinary/carrier_wave/remote.rb
cloudinary-1.0.79 lib/cloudinary/carrier_wave/remote.rb
cloudinary-1.0.78 lib/cloudinary/carrier_wave/remote.rb
cloudinary-1.0.77 lib/cloudinary/carrier_wave/remote.rb
cloudinary-1.0.76 lib/cloudinary/carrier_wave/remote.rb
cloudinary-1.0.75 lib/cloudinary/carrier_wave/remote.rb
cloudinary-1.0.74 lib/cloudinary/carrier_wave/remote.rb
cloudinary-1.0.73 lib/cloudinary/carrier_wave/remote.rb
cloudinary-1.0.72 lib/cloudinary/carrier_wave/remote.rb
cloudinary-1.0.71 lib/cloudinary/carrier_wave/remote.rb
cloudinary-1.0.70 lib/cloudinary/carrier_wave/remote.rb
cloudinary-1.0.69 lib/cloudinary/carrier_wave/remote.rb
cloudinary-1.0.68 lib/cloudinary/carrier_wave/remote.rb
cloudinary-1.0.67 lib/cloudinary/carrier_wave/remote.rb
cloudinary-1.0.66 lib/cloudinary/carrier_wave/remote.rb
cloudinary-1.0.65 lib/cloudinary/carrier_wave/remote.rb
cloudinary-1.0.64 lib/cloudinary/carrier_wave/remote.rb
cloudinary-1.0.63 lib/cloudinary/carrier_wave/remote.rb
cloudinary-1.0.62 lib/cloudinary/carrier_wave/remote.rb
cloudinary-1.0.61 lib/cloudinary/carrier_wave/remote.rb