Sha256: 4b719b3e5bf667560ed09ecc76be710be66a1fabc86a1d4a9865e77d3579a9d6

Contents?: true

Size: 635 Bytes

Versions: 4

Compression:

Stored size: 635 Bytes

Contents

require "anyfetch/open_uri"
require "anyfetch/original_filename/content_type"

module Anyfetch
  class FTP < OpenURI
    def initialize(uri, options = {})
      @uri = uri
      @options = options
      setup_auth
    end

    private

    def setup_auth
      if @uri.user
        # URI-encoded user must be passed to open-uri
        # Rollback URI-encoding of user here
        @uri.instance_variable_set "@user", URI.decode(@uri.user)
      end

      if @uri.password
        # Rollback URI-encoding of password by open-uri lib
        @uri.instance_variable_set "@password", URI.decode(@uri.password)
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
anyfetch-0.1.7 lib/anyfetch/ftp.rb
anyfetch-0.1.6 lib/anyfetch/ftp.rb
anyfetch-0.1.5 lib/anyfetch/ftp.rb
anyfetch-0.1.4 lib/anyfetch/ftp.rb