Skip to content

Commit d8ee229

Browse files
committed
download: Fix bug of pkg_verified path extension
Before PR #87, target_filename was almost always `None`, which had covered an issue of setting pkg_verified. In case of target_filename being a valid String, for example "oem-azure.gz", pkg_verified ended up having an extension `.gz`, which is not expected. Now that the PR was merged, DownloadVerify module gets created with .target_filename(args.target_filename.unwrap_or(TARGET_FILENAME_DEFAULT.into())), where TARGET_FILENAME_DEFAULT is with ".gz" extension. That uncovered the hidden issue. Fix that with explicitly setting extension ".raw" for both a valid String and None for the input string. Signed-off-by: Dongsu Park <[email protected]>
1 parent c6e869f commit d8ee229

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/download/mod.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,8 @@ fn do_download_verify(pkg: &mut Package<'_>, output_filename: Option<String>, ou
212212
// Unverified payload is stored in e.g. "output_dir/.unverified/oem.gz".
213213
// Verified payload is stored in e.g. "output_dir/oem.raw".
214214
let pkg_unverified = unverified_dir.join(&*pkg.name);
215-
let pkg_verified = output_dir.join(output_filename.as_ref().map(OsStr::new).unwrap_or(pkg_unverified.with_extension("raw").file_name().unwrap_or_default()));
215+
let mut pkg_verified = output_dir.join(output_filename.as_ref().map(OsStr::new).unwrap_or(pkg_unverified.with_extension("raw").file_name().unwrap_or_default()));
216+
pkg_verified.set_extension("raw");
216217

217218
let datablobspath = pkg.verify_signature_on_disk(&pkg_unverified, pubkey_file).context(format!("unable to verify signature \"{}\"", pkg.name))?;
218219

0 commit comments

Comments
 (0)