jruby/jruby — pull request #410 by jcrivera (2012-11-24 20:49:34+00:00)
Title: jruby-172 Dir.glob properly handle escaped braces in glob pattern

Nested-glob handling was not treating braces escaped with backslash as literal file path bytes. This solution detects the case of escaped braces (previous code was checking for no or mismatched braces) and removes those escape bytes, then passes the modified pattern to file name matching code.

E.g., Dir["special/test\{1\}/*"] was interpreting the braces as special glob pattern characters instead of respecting the escape backslashes.

Intercepting that case and sending the pattern along to the underlying file name match code wasn't enough, because at that point it was using File.isDirectory on the still-escaped pattern, including the backslashes, which didn't match the real file name. So the pattern had to be modified to remove them.