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 {
446446
447447 // It must be "none" or a valid URL.
448448 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+ });
451455 }
452456 }
453457
Original file line number Diff line number Diff line change @@ -557,6 +557,11 @@ publish_to: none
557557 expectPubspecException ('publish_to: http://bad.url:not-port' ,
558558 (pubspec) => pubspec.publishTo);
559559 });
560+
561+ test ("throws on non-absolute URLs" , () {
562+ expectPubspecException (
563+ 'publish_to: pub.dartlang.org' , (pubspec) => pubspec.publishTo);
564+ });
560565 });
561566
562567 group ("executables" , () {
You can’t perform that action at this time.
0 commit comments