@@ -103,7 +103,6 @@ pub struct EncodableCrate {
103
103
pub description : Option < String > ,
104
104
pub homepage : Option < String > ,
105
105
pub documentation : Option < String > ,
106
- pub license : Option < String > ,
107
106
pub repository : Option < String > ,
108
107
pub links : CrateLinks ,
109
108
pub exact_match : bool ,
@@ -133,14 +132,13 @@ pub struct NewCrate<'a> {
133
132
134
133
impl < ' a > NewCrate < ' a > {
135
134
pub fn create_or_update (
136
- mut self ,
135
+ self ,
137
136
conn : & PgConnection ,
138
- license_file : Option < & str > ,
139
137
uploader : i32 ,
140
138
) -> CargoResult < Crate > {
141
139
use diesel:: update;
142
140
143
- self . validate ( license_file ) ?;
141
+ self . validate ( ) ?;
144
142
self . ensure_name_not_reserved ( conn) ?;
145
143
146
144
conn. transaction ( || {
@@ -161,7 +159,7 @@ impl<'a> NewCrate<'a> {
161
159
} )
162
160
}
163
161
164
- fn validate ( & mut self , license_file : Option < & str > ) -> CargoResult < ( ) > {
162
+ fn validate ( & self ) -> CargoResult < ( ) > {
165
163
fn validate_url ( url : Option < & str > , field : & str ) -> CargoResult < ( ) > {
166
164
let url = match url {
167
165
Some ( s) => s,
@@ -195,28 +193,6 @@ impl<'a> NewCrate<'a> {
195
193
validate_url ( self . homepage , "homepage" ) ?;
196
194
validate_url ( self . documentation , "documentation" ) ?;
197
195
validate_url ( self . repository , "repository" ) ?;
198
- self . validate_license ( license_file) ?;
199
- Ok ( ( ) )
200
- }
201
-
202
- fn validate_license ( & mut self , license_file : Option < & str > ) -> CargoResult < ( ) > {
203
- if let Some ( license) = self . license {
204
- for part in license. split ( '/' ) {
205
- license_exprs:: validate_license_expr ( part) . map_err ( |e| {
206
- human ( & format_args ! (
207
- "{}; see http://opensource.org/licenses \
208
- for options, and http://spdx.org/licenses/ \
209
- for their identifiers",
210
- e
211
- ) )
212
- } ) ?;
213
- }
214
- } else if license_file. is_some ( ) {
215
- // If no license is given, but a license file is given, flag this
216
- // crate as having a nonstandard license. Note that we don't
217
- // actually do anything else with license_file currently.
218
- self . license = Some ( "non-standard" ) ;
219
- }
220
196
Ok ( ( ) )
221
197
}
222
198
@@ -503,7 +479,6 @@ impl Crate {
503
479
description,
504
480
homepage,
505
481
documentation,
506
- license,
507
482
repository,
508
483
..
509
484
} = self ;
@@ -529,7 +504,6 @@ impl Crate {
529
504
homepage : homepage,
530
505
exact_match : exact_match,
531
506
description : description,
532
- license : license,
533
507
repository : repository,
534
508
links : CrateLinks {
535
509
version_downloads : format ! ( "/api/v1/crates/{}/downloads" , name) ,
@@ -1083,8 +1057,9 @@ pub fn new(req: &mut Request) -> CargoResult<Response> {
1083
1057
license : new_crate. license . as_ref ( ) . map ( |s| & * * s) ,
1084
1058
max_upload_size : None ,
1085
1059
} ;
1060
+
1086
1061
let license_file = new_crate. license_file . as_ref ( ) . map ( |s| & * * s) ;
1087
- let krate = persist. create_or_update ( & conn, license_file , user. id ) ?;
1062
+ let krate = persist. create_or_update ( & conn, user. id ) ?;
1088
1063
1089
1064
let owners = krate. owners ( & conn) ?;
1090
1065
if rights ( req. app ( ) , & owners, & user) ? < Rights :: Publish {
0 commit comments