Sha256: 988458568e6817e96355a50f16a58657a4f5650a51c8df97369e9c5fd5e93fc7

Contents?: true

Size: 557 Bytes

Versions: 6

Compression:

Stored size: 557 Bytes

Contents

# frozen_string_literal: true

require_relative 'command_handler'

module Ftpd

  class CmdNlst < CommandHandler

    def cmd_nlst(argument)
      close_data_server_socket_when_done do
        ensure_logged_in
        ensure_file_system_supports :dir
        path = list_path(argument)
        path = File.expand_path(path, name_prefix)
        transmit_file(StringIO.new(name_list(path)), 'A')
      end
    end

    private

    def name_list(path)
      path_list(path).map do |path|
        File.basename(path) + "\n"
      end.join
    end

  end

end

Version data entries

6 entries across 6 versions & 1 rubygems

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