Sha256: a5eadad92146cac5959a220daa0416c8054eda9ab20cfb89bd9ff0026d72cda7

Contents?: true

Size: 701 Bytes

Versions: 7

Compression:

Stored size: 701 Bytes

Contents

# frozen_string_literal: true

module Ftpd

  # Functions for manipulating LIST and NLST arguments

  module ListPath

    # Turn the argument to LIST/NLST into a path
    #
    # @param argument [String] The argument, or nil if not present
    # @return [String] The path
    #
    # Although compliant with the spec, this function does not do
    # these things that traditional Unix FTP servers do:
    #
    # * Allow multiple paths
    # * Handle switches such as "-a"
    #
    # See: http://cr.yp.to/ftp/list.html sections "LIST parameters"
    # and "LIST wildcards"

    def list_path(argument)
      argument ||= '.'
      argument = '' if argument =~ /^-/
      argument
    end

  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
ftpd-2.1.0 lib/ftpd/list_path.rb
ftpd-2.0.5 lib/ftpd/list_path.rb
ftpd-2.0.4 lib/ftpd/list_path.rb
ftpd-2.0.3 lib/ftpd/list_path.rb
ftpd-2.0.2 lib/ftpd/list_path.rb
ftpd-2.0.1 lib/ftpd/list_path.rb
ftpd-2.0.0 lib/ftpd/list_path.rb