diff --git a/lib/sass/gem_package_importer.rb b/lib/sass/gem_package_importer.rb index b0b0eee2..fc27f0fd 100644 --- a/lib/sass/gem_package_importer.rb +++ b/lib/sass/gem_package_importer.rb @@ -7,10 +7,10 @@ class GemPackageImporter def find_file_url(url, _canonicalize_context) return unless url.start_with?('pkg:') - library, _, path = url[4..].partition('/') + library, _, path = url[4..].partition(/[?#]/).first.partition('/') gem_dir = Gem::Dependency.new(library).to_spec.gem_dir - "file://#{'/' unless gem_dir.start_with?('/')}#{gem_dir}/#{path}" + "file://#{'/' unless gem_dir.start_with?('/')}#{gem_dir.gsub(/[?#]/, { '?' => '%3F', '#' => '%23' })}/#{path}" rescue Gem::MissingSpecError nil end