File tree Expand file tree Collapse file tree 2 files changed +11
-2
lines changed Expand file tree Collapse file tree 2 files changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -446,8 +446,12 @@ class Pubspec {
446
446
447
447
// It must be "none" or a valid URL.
448
448
if (publishTo != "none" ) {
449
- _wrapFormatException (
450
- '"publish_to" field' , span, () => Uri .parse (publishTo));
449
+ _wrapFormatException ('"publish_to" field' , span, () {
450
+ var url = Uri .parse (publishTo);
451
+ if (url.scheme.isEmpty) {
452
+ throw new FormatException ("must be an absolute URL." );
453
+ }
454
+ });
451
455
}
452
456
}
453
457
Original file line number Diff line number Diff line change @@ -557,6 +557,11 @@ publish_to: none
557
557
expectPubspecException ('publish_to: http://bad.url:not-port' ,
558
558
(pubspec) => pubspec.publishTo);
559
559
});
560
+
561
+ test ("throws on non-absolute URLs" , () {
562
+ expectPubspecException (
563
+ 'publish_to: pub.dartlang.org' , (pubspec) => pubspec.publishTo);
564
+ });
560
565
});
561
566
562
567
group ("executables" , () {
You can’t perform that action at this time.
0 commit comments