Skip to content

Commit

Permalink
Avoid potential issues caused by Dart Uri normalization
Browse files Browse the repository at this point in the history
  • Loading branch information
ntkme committed Jul 7, 2024
1 parent f42ffac commit f674b0e
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions lib/sassc/embedded.rb
Original file line number Diff line number Diff line change
Expand Up @@ -308,6 +308,7 @@ class ImportCache
def initialize(importer)
@importer = importer
@importer_results = {}
@importer_result = nil
@file_url = nil
end

Expand All @@ -323,6 +324,7 @@ def canonicalize(url, context)
if containing_url.include?('?')
canonical_url = Uri.path_to_file_url(File.absolute_path(path, parent_dir))
if @importer_results.key?(canonical_url)
@importer_result = @importer_results.delete(canonical_url)
canonical_url
else
@file_url = resolve_file_url(path, parent_dir, context.from_import)
Expand All @@ -334,6 +336,7 @@ def canonicalize(url, context)
imports = [imports] unless imports.is_a?(Array)
canonical_url = imports_to_native(imports, parent_dir, context.from_import, url, containing_url)
if @importer_results.key?(canonical_url)
@importer_result = @importer_results.delete(canonical_url)
canonical_url
else
@file_url = canonical_url
Expand All @@ -342,8 +345,10 @@ def canonicalize(url, context)
end
end

def load(canonical_url)
@importer_results.delete(canonical_url)
def load(_canonical_url)
importer_result = @importer_result
@importer_result = nil
importer_result
end

def find_file_url(_url, context)
Expand Down

0 comments on commit f674b0e

Please sign in to comment.