Skip to content

Commit b9b4b05

Browse files
author
Matt
committed
Escape base path so that template name base path removal works when unsafe regex characters (like parens) are in the base path
1 parent 0a2e1a9 commit b9b4b05

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

lib/jammit/compressor.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ def find_base_path(paths)
128128
# the namespaced prefix. Otherwise, simply use the filename.
129129
def template_name(path, base_path)
130130
return File.basename(path, ".#{Jammit.template_extension}") unless base_path
131-
path.gsub(/\A#{base_path}\/(.*)\.#{Jammit.template_extension}\Z/, '\1')
131+
path.gsub(/\A#{Regexp.escape(base_path)}\/(.*)\.#{Jammit.template_extension}\Z/, '\1')
132132
end
133133

134134
# In order to support embedded assets from relative paths, we need to

0 commit comments

Comments
 (0)