Skip to content

Commit 8153663

Browse files
committed
Handle ? and # in Sass::GemPackageImporter
1 parent 98ea3de commit 8153663

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lib/sass/gem_package_importer.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@ class GemPackageImporter
77
def find_file_url(url, _canonicalize_context)
88
return unless url.start_with?('pkg:')
99

10-
library, _, path = url[4..].partition('/')
10+
library, _, path = url[4..].partition(/[?#]/).first.partition('/')
1111
gem_dir = Gem::Dependency.new(library).to_spec.gem_dir
1212

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

0 commit comments

Comments
 (0)