lib/net/ftp/list/unix.rb in net-ftp-list-3.2.1 vs lib/net/ftp/list/unix.rb in net-ftp-list-3.2.2
- old
+ new
@@ -12,11 +12,11 @@
# Stolen straight from the ASF's commons Java FTP LIST parser library.
# http://svn.apache.org/repos/asf/commons/proper/net/trunk/src/java/org/apache/commons/net/ftp/
REGEXP = %r{
([pbcdlfmpSs-])
(((r|-)(w|-)([xsStTL-]))((r|-)(w|-)([xsStTL-]))((r|-)(w|-)([xsStTL-])))\+?\s+
- (\d+)\s+
+ (?:(\d+)\s+)?
(\S+)\s+
(?:(\S+(?:\s\S+)*)\s+)?
(?:\d+,\s+)?
(\d+)\s+
((?:\d+[-/]\d+[-/]\d+)|(?:\S+\s+\S+))\s+
@@ -36,9 +36,12 @@
when /l/ then symlink = true
when /[f-]/ then file = true
when /[psbc]/ then device = true
end
return false unless dir or symlink or file or device
+
+ # Don't match on rumpus (which looks very similar to unix)
+ return false if match[17].nil? and ((match[15].nil? and match[16].to_s == 'folder') or match[15].to_s == '0')
# TODO: Permissions, users, groups, date/time.
filesize = match[18].to_i
mtime_string = "#{match[19]} #{match[20]}"
mtime = Time.parse(mtime_string)