From d0b14082e76120df31457fa3791a1dd374157b3d Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Sun, 13 Jun 2010 11:51:41 -0400 Subject: [PATCH] Only enumerate accounts in domains whose folders exist. --- src/dovecot_mailstore.rb | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/dovecot_mailstore.rb b/src/dovecot_mailstore.rb index a794032..81eb167 100644 --- a/src/dovecot_mailstore.rb +++ b/src/dovecot_mailstore.rb @@ -13,10 +13,16 @@ class DovecotMailstore < Mailstore domains.each do |domain| domain_path = File.join(@domain_root, domain) - usernames = Filesystem.get_subdirs(domain_path) - usernames.each do |username| - accounts << "#{username}@#{domain}" + if File.directory?(domain_path) + # If domain_path isn't a directory, maybe the + # domain folder doesn't exist? In that case, I + # guess we want to report zero accounts. + usernames = Filesystem.get_subdirs(domain_path) + + usernames.each do |username| + accounts << "#{username}@#{domain}" + end end end -- 2.44.2