Module: Ftpd::ListPath

Included in:
Session
Defined in:
lib/ftpd/list_path.rb

Overview

Functions for manipulating LIST and NLST arguments

Instance Method Summary collapse

Instance Method Details

#list_path(argument) ⇒ String

Turn the argument to LIST/NLST into a 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: cr.yp.to/ftp/list.html sections “LIST parameters” and “LIST wildcards”

Parameters:

  • argument (String)

    The argument, or nil if not present

Returns:

  • (String)

    The path



21
22
23
24
25
# File 'lib/ftpd/list_path.rb', line 21

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