File tree Expand file tree Collapse file tree 1 file changed +5
-0
lines changed Expand file tree Collapse file tree 1 file changed +5
-0
lines changed Original file line number Diff line number Diff line change @@ -97,6 +97,9 @@ impl PackageIdSpec {
97
97
98
98
/// Tries to convert a valid `Url` to a `PackageIdSpec`.
99
99
fn from_url ( mut url : Url ) -> CargoResult < PackageIdSpec > {
100
+ if url. host ( ) . is_none ( ) {
101
+ bail ! ( "pkgid urls must have a host: {}" , url)
102
+ }
100
103
if url. query ( ) . is_some ( ) {
101
104
bail ! ( "cannot have a query string in a pkgid: {}" , url)
102
105
}
@@ -405,6 +408,8 @@ mod tests {
405
408
assert ! ( PackageIdSpec :: parse( "baz:1.0" ) . is_err( ) ) ;
406
409
assert ! ( PackageIdSpec :: parse( "https://baz:1.0" ) . is_err( ) ) ;
407
410
assert ! ( PackageIdSpec :: parse( "https://#baz:1.0" ) . is_err( ) ) ;
411
+ assert ! ( PackageIdSpec :: parse( "file:///baz" ) . is_err( ) ) ;
412
+ assert ! ( PackageIdSpec :: parse( "/baz" ) . is_err( ) ) ;
408
413
}
409
414
410
415
#[ test]
You can’t perform that action at this time.
0 commit comments