mirror of
https://github.com/danog/dart-sass.git
synced 2024-11-26 20:24:42 +01:00
Fix a crash in the Node importer
When a path was returned at the same time as a file's contents, it was interpreted as a URL without first being translated to one. This crashed for absolute Windows paths. Closes #1410
This commit is contained in:
parent
c07f46175b
commit
4fd0472f2e
@ -1,3 +1,8 @@
|
||||
## 1.37.6
|
||||
|
||||
* Don't crash when a Windows path is returned by a custom Node importer at the
|
||||
same time as file contents.
|
||||
|
||||
## 1.37.5
|
||||
|
||||
* No user-visible changes.
|
||||
|
@ -186,7 +186,7 @@ class NodeImporter {
|
||||
if (file == null) {
|
||||
return Tuple2(contents ?? '', url);
|
||||
} else if (contents != null) {
|
||||
return Tuple2(contents, file);
|
||||
return Tuple2(contents, p.toUri(file).toString());
|
||||
} else {
|
||||
var resolved =
|
||||
loadRelative(p.toUri(file).toString(), previous, forImport) ??
|
||||
|
@ -1,5 +1,5 @@
|
||||
name: sass
|
||||
version: 1.37.5
|
||||
version: 1.37.6-dev
|
||||
description: A Sass implementation in Dart.
|
||||
homepage: https://github.com/sass/dart-sass
|
||||
|
||||
|
@ -141,6 +141,16 @@ void main() {
|
||||
}))));
|
||||
expect(result.stats.includedFiles, equals(['bar']));
|
||||
});
|
||||
|
||||
// Regression test for sass/dart-sass#1410.
|
||||
test("passes through an absolute file path", () {
|
||||
var result = sass.renderSync(RenderOptions(
|
||||
data: "@import 'foo'",
|
||||
importer: allowInterop(expectAsync2((void _, void __) {
|
||||
return NodeImporterResult(contents: '', file: p.absolute('bar'));
|
||||
}))));
|
||||
expect(result.stats.includedFiles, equals([p.absolute('bar')]));
|
||||
});
|
||||
});
|
||||
|
||||
group("with a file redirect", () {
|
||||
|
Loading…
Reference in New Issue
Block a user