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.4.0 lib/cloudinary/carrier_wave/remote.rb
cloudinary-1.3.0 lib/cloudinary/carrier_wave/remote.rb
cloudinary-1.2.4 lib/cloudinary/carrier_wave/remote.rb
cloudinary-1.2.3 lib/cloudinary/carrier_wave/remote.rb
cloudinary-1.2.2 lib/cloudinary/carrier_wave/remote.rb
cloudinary-1.2.1 lib/cloudinary/carrier_wave/remote.rb
cloudinary-1.2.0 lib/cloudinary/carrier_wave/remote.rb
cloudinary-1.1.7 lib/cloudinary/carrier_wave/remote.rb
cloudinary-1.1.6 lib/cloudinary/carrier_wave/remote.rb
cloudinary-1.1.5 lib/cloudinary/carrier_wave/remote.rb
cloudinary-1.1.4 lib/cloudinary/carrier_wave/remote.rb
cloudinary-1.1.3 lib/cloudinary/carrier_wave/remote.rb
cloudinary-1.1.2 lib/cloudinary/carrier_wave/remote.rb
cloudinary-1.1.1 lib/cloudinary/carrier_wave/remote.rb
cloudinary-1.1.0 lib/cloudinary/carrier_wave/remote.rb
cloudinary-1.0.85 lib/cloudinary/carrier_wave/remote.rb
cloudinary-1.0.84 lib/cloudinary/carrier_wave/remote.rb
cloudinary-1.0.83 lib/cloudinary/carrier_wave/remote.rb
cloudinary-1.0.82 lib/cloudinary/carrier_wave/remote.rb
cloudinary-1.0.81 lib/cloudinary/carrier_wave/remote.rb