| Index: lib/src/source/git.dart
|
| diff --git a/lib/src/source/git.dart b/lib/src/source/git.dart
|
| index 06981fab70f821a28b3836f5956bd46a29c45f58..8fc1014606c7ed274a503983b859b7fb83dce696 100644
|
| --- a/lib/src/source/git.dart
|
| +++ b/lib/src/source/git.dart
|
| @@ -135,8 +135,7 @@ class GitSource extends CachedSource {
|
| "string.");
|
| }
|
|
|
| - // Ensure that it's a valid URL.
|
| - Uri.parse(description["url"]);
|
| + _validateUrl(description["url"]);
|
|
|
| var ref = description["ref"];
|
| if (ref != null && ref is! String) {
|
| @@ -161,8 +160,7 @@ class GitSource extends CachedSource {
|
| "string.");
|
| }
|
|
|
| - // Ensure that it's a valid URL.
|
| - Uri.parse(description["url"]);
|
| + _validateUrl(description["url"]);
|
|
|
| var ref = description["ref"];
|
| if (ref != null && ref is! String) {
|
| @@ -182,6 +180,16 @@ class GitSource extends CachedSource {
|
| });
|
| }
|
|
|
| + /// Throws a [FormatException] if [url] isn't a valid Git URL.
|
| + void _validateUrl(String url) {
|
| + // If the URL contains an @, it's probably an SSH hostname, which we don't
|
| + // know how to validate.
|
| + if (url.contains("@")) return;
|
| +
|
| + // Otherwise, we use Dart's URL parser to validate the URL.
|
| + Uri.parse(url);
|
| + }
|
| +
|
| /// If [description] has a resolved ref, print it out in short-form.
|
| ///
|
| /// This helps distinguish different git commits with the same pubspec
|
|
|