Permalink
Browse files

Don't accidently interpret filenames with glob characters as glob cha…

…racters during partial lookup.
  • Loading branch information...
chriseppstein committed Jun 4, 2011
1 parent bbba416 commit acde58b636fadaa37665f294acabb62394b29f58
Showing with 6 additions and 0 deletions.
  1. +6 −0 lib/sass/importers/filesystem.rb
@@ -85,6 +85,7 @@ def extensions
# The first element of each pair is a filename to look for;
# the second element is the syntax that file would be in (`:sass` or `:scss`).
def possible_files(name)
+ name = escape_glob_characters(name)
dirname, basename, extname = split(name)
sorted_exts = extensions.sort
syntax = extensions[extname]
@@ -93,6 +94,11 @@ def possible_files(name)
sorted_exts.map {|ext, syn| ["#{dirname}/{_,}#{basename}.#{ext}", syn]}
end
+ def escape_glob_characters(name)
+ name.gsub(/[\*\[\]\{\}\?]/) do |char|
+ "\\#{char}"
+ end
+ end
REDUNDANT_DIRECTORY = %r{#{Regexp.escape(File::SEPARATOR)}\.#{Regexp.escape(File::SEPARATOR)}}
# Given a base directory and an `@import`ed name,

0 comments on commit acde58b

Please sign in to comment.