We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents d2100cc + 288d193 commit e2fbec7Copy full SHA for e2fbec7
lib/net/sftp/operations/dir.rb
@@ -57,10 +57,10 @@ def entries(path)
57
# it should be able to handle modest numbers of files in each directory.
58
def glob(path, pattern, flags=0)
59
flags |= ::File::FNM_PATHNAME
60
- path = path.chop if path[-1,1] == "/"
+ path = path.chop if path.end_with?('/') && path != '/'
61
62
results = [] unless block_given?
63
- queue = entries(path).reject { |e| e.name == "." || e.name == ".." }
+ queue = entries(path).reject { |e| %w(. ..).include?(e.name) }
64
while queue.any?
65
entry = queue.shift
66
@@ -90,4 +90,4 @@ def [](path, pattern)
90
end
91
92
93
-end; end; end
+end; end; end
0 commit comments