Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automatically handle absolute URLs for FileImporters #1527

Merged
merged 1 commit into from Oct 13, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/src/importer/node_to_dart/async_file.dart
Expand Up @@ -30,7 +30,7 @@ class NodeToDartAsyncFileImporter extends AsyncImporter {
NodeToDartAsyncFileImporter(this._findFileUrl);

FutureOr<Uri?> canonicalize(Uri url) async {
if (url.scheme != 'file' && url.scheme != '') return null;
if (url.scheme == 'file') return _filesystemImporter.canonicalize(url);

var result = _findFileUrl(
url.toString(), CanonicalizeOptions(fromImport: fromImport));
Expand Down
2 changes: 1 addition & 1 deletion lib/src/importer/node_to_dart/file.dart
Expand Up @@ -27,7 +27,7 @@ class NodeToDartFileImporter extends Importer {
NodeToDartFileImporter(this._findFileUrl);

Uri? canonicalize(Uri url) {
if (url.scheme != 'file' && url.scheme != '') return null;
if (url.scheme == 'file') return _filesystemImporter.canonicalize(url);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldn't you keep a if (url.scheme != '') return null; after that ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, we want custom importers to have the ability to use custom schemes .


var result = _findFileUrl(
url.toString(), CanonicalizeOptions(fromImport: fromImport));
Expand Down