lib/file/find.rb in file-find-0.3.6 vs lib/file/find.rb in file-find-0.3.7

- old
+ new

@@ -8,11 +8,11 @@ require 'etc' end class File::Find # The version of the file-find library - VERSION = '0.3.6' + VERSION = '0.3.7' # :stopdoc: VALID_OPTIONS = %w/ atime ctime @@ -234,21 +234,21 @@ end file = File.join(path, file) stat_method = @follow ? :stat : :lstat - # Skip files we cannot access, stale links, etc. begin stat_info = File.send(stat_method, file) rescue Errno::ENOENT, Errno::EACCES next rescue Errno::ELOOP stat_method = :lstat # Handle recursive symlinks retry if stat_method.to_s != 'lstat' end - glob = File.join(File.dirname(file), @name) + # We need to escape any brackets in the directory name. + glob = File.join(File.dirname(file).gsub(/([\[\]])/,'\\\\\1'), @name) # Dir[] doesn't like backslashes if File::ALT_SEPARATOR file.tr!(File::ALT_SEPARATOR, File::SEPARATOR) glob.tr!(File::ALT_SEPARATOR, File::SEPARATOR)