Skip to content

Commit 7689f30

Browse files
committed
Fix removal of trailing slash for root dir
1 parent 9d4e24a commit 7689f30

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lib/net/sftp/operations/dir.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ def entries(path)
5757
# it should be able to handle modest numbers of files in each directory.
5858
def glob(path, pattern, flags=0)
5959
flags |= ::File::FNM_PATHNAME
60-
path = path.chop if path[-1,1] == "/"
60+
path = path.chop if path.end_with?('/') && path != '/'
6161

6262
results = [] unless block_given?
6363
queue = entries(path).reject { |e| e.name == "." || e.name == ".." }
@@ -90,4 +90,4 @@ def [](path, pattern)
9090
end
9191
end
9292

93-
end; end; end
93+
end; end; end

0 commit comments

Comments
 (0)