Skip to content

Commit

Permalink
Treat CLI args as paths, not URLs (#239)
Browse files Browse the repository at this point in the history
Fixes #237.
  • Loading branch information
jathak authored Feb 27, 2023
1 parent 437242e commit 1e74aca
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 2 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
## 1.7.3

* Fixes a bug where path arguments on the command line were incorrectly treated
as URLs, resulting in errors finding paths containing certain special
characters.

## 1.7.2

### Module Migrator
Expand Down
2 changes: 1 addition & 1 deletion lib/src/migrator.dart
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ abstract class Migrator extends Command<Map<Uri, String>> {
];
for (var entrypoint in entrypoints) {
var tuple =
importCache.import(Uri.parse(entrypoint), baseImporter: importer);
importCache.import(p.toUri(entrypoint), baseImporter: importer);
if (tuple == null) {
throw MigrationException("Could not find Sass file at '$entrypoint'.");
}
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: sass_migrator
version: 1.7.2
version: 1.7.3
description: A tool for running migrations on Sass files
homepage: https://github.com/sass/migrator

Expand Down
8 changes: 8 additions & 0 deletions test/cli_dart_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,14 @@ void main() {
]).validate();
});

test("treats file arguments as paths, not urls", () async {
await d.file("#file.scss", "a {b: (1 / 2)}").create();

await (await runMigrator(["division", "#file.scss"])).shouldExit(0);

await d.file("#file.scss", 'a {b: (1 * 0.5)}').validate();
});

test("allows non-glob file arguments containing glob syntax", () async {
await d.dir('[dir]', [d.file("test.scss", "a {b: (1 / 2)}")]).create();

Expand Down

0 comments on commit 1e74aca

Please sign in to comment.