@@ -125,6 +125,14 @@ pub async fn publish(app: AppState, req: BytesRequest) -> AppResult<Json<GoodCra
125
125
) ) ) ;
126
126
}
127
127
128
+ let pkg_name = format ! ( "{}-{}" , & * metadata. name, & * metadata. vers) ;
129
+ let tarball_info = process_tarball ( & pkg_name, & * tarball_bytes, maximums. max_unpack_size ) ?;
130
+
131
+ // `unwrap()` is safe here since `process_tarball()` validates that
132
+ // we only accept manifests with a `package` section and without
133
+ // inheritance.
134
+ let package = tarball_info. manifest . package . unwrap ( ) ;
135
+
128
136
// Create a transaction on the database, if there are no errors,
129
137
// commit the transactions to record a new or updated crate.
130
138
conn. transaction ( |conn| {
@@ -195,14 +203,6 @@ pub async fn publish(app: AppState, req: BytesRequest) -> AppResult<Json<GoodCra
195
203
// Read tarball from request
196
204
let hex_cksum: String = Sha256 :: digest ( & tarball_bytes) . encode_hex ( ) ;
197
205
198
- let pkg_name = format ! ( "{}-{}" , krate. name, vers) ;
199
- let tarball_info =
200
- process_tarball ( & pkg_name, & * tarball_bytes, maximums. max_unpack_size ) ?;
201
-
202
- // `unwrap()` is safe here since `process_tarball()` validates that
203
- // we only accept manifests with a `package` section and without
204
- // inheritance.
205
- let package = tarball_info. manifest . package . unwrap ( ) ;
206
206
let rust_version = package. rust_version . map ( |rv| rv. as_local ( ) . unwrap ( ) ) ;
207
207
208
208
// Persist the new version of this crate
0 commit comments