@@ -125,6 +125,14 @@ pub async fn publish(app: AppState, req: BytesRequest) -> AppResult<Json<GoodCra
125125 ) ) ) ;
126126 }
127127
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+
128136 // Create a transaction on the database, if there are no errors,
129137 // commit the transactions to record a new or updated crate.
130138 conn. transaction ( |conn| {
@@ -195,14 +203,6 @@ pub async fn publish(app: AppState, req: BytesRequest) -> AppResult<Json<GoodCra
195203 // Read tarball from request
196204 let hex_cksum: String = Sha256 :: digest ( & tarball_bytes) . encode_hex ( ) ;
197205
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 ( ) ;
206206 let rust_version = package. rust_version . map ( |rv| rv. as_local ( ) . unwrap ( ) ) ;
207207
208208 // Persist the new version of this crate
0 commit comments