Skip to content

Commit e144d87

Browse files
committed
Escape % in Sass::GemPackageImporter
1 parent c1f8882 commit e144d87

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

lib/sass/gem_package_importer.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,9 @@ def find_file_url(url, _canonicalize_context)
99

1010
library, _, path = url[4..].partition(/[?#]/).first.partition('/')
1111
gem_dir = Gem::Dependency.new(library).to_spec.gem_dir
12+
gem_dir = "/#{gem_dir}" unless gem_dir.start_with?('/')
1213

13-
"file://#{'/' unless gem_dir.start_with?('/')}#{gem_dir.gsub(/[?#]/, { '?' => '%3F', '#' => '%23' })}/#{path}"
14+
"file://#{gem_dir.gsub(/[?#%]/, { '?' => '%3F', '#' => '%23', '%' => '%25' })}/#{path}"
1415
rescue Gem::MissingSpecError
1516
nil
1617
end

0 commit comments

Comments
 (0)