@@ -105,24 +105,22 @@ pub async fn process_tarball<R: tokio::io::AsyncRead + Unpin>(
105105
106106 // Let's go hunting for the VCS info and crate manifest. The only valid place for these is
107107 // in the package root in the tarball.
108- if entry_path. parent ( ) == Some ( pkg_root) {
109- let entry_file = entry_path. file_name ( ) . unwrap_or_default ( ) ;
110- if entry_file == ".cargo_vcs_info.json" {
111- let mut contents = String :: new ( ) ;
112- entry. read_to_string ( & mut contents) . await ?;
113- vcs_info = CargoVcsInfo :: from_contents ( & contents) . ok ( ) ;
114- } else if entry_file. eq_ignore_ascii_case ( "cargo.toml" ) {
115- // Try to extract and read the Cargo.toml from the tarball, silently erroring if it
116- // cannot be read.
117- let owned_entry_path = entry_path. into_owned ( ) ;
118- let mut contents = String :: new ( ) ;
119- entry. read_to_string ( & mut contents) . await ?;
120-
121- let manifest = Manifest :: from_str ( & contents) ?;
122- validate_manifest ( & manifest) ?;
123-
124- manifests. insert ( owned_entry_path, manifest) ;
125- }
108+ let in_pkg_path_str = in_pkg_path. to_string_lossy ( ) ;
109+ if in_pkg_path_str == ".cargo_vcs_info.json" {
110+ let mut contents = String :: new ( ) ;
111+ entry. read_to_string ( & mut contents) . await ?;
112+ vcs_info = CargoVcsInfo :: from_contents ( & contents) . ok ( ) ;
113+ } else if in_pkg_path_str. eq_ignore_ascii_case ( "cargo.toml" ) {
114+ // Try to extract and read the Cargo.toml from the tarball, silently erroring if it
115+ // cannot be read.
116+ let owned_entry_path = entry_path. into_owned ( ) ;
117+ let mut contents = String :: new ( ) ;
118+ entry. read_to_string ( & mut contents) . await ?;
119+
120+ let manifest = Manifest :: from_str ( & contents) ?;
121+ validate_manifest ( & manifest) ?;
122+
123+ manifests. insert ( owned_entry_path, manifest) ;
126124 }
127125 }
128126
0 commit comments