pfl_upg: prevent file collisions (needs more work)

This commit is contained in:
theubusu
2025-11-28 00:05:23 +01:00
parent b608888538
commit 75674ca8e2
2 changed files with 16 additions and 2 deletions
+14 -1
View File
@@ -153,7 +153,20 @@ pub fn extract_pfl_upg(mut file: &File, output_folder: &str) -> Result<(), Box<d
let data = common::read_exact(&mut data_reader, file_header.stored_size as usize)?;
let output_path = Path::new(&output_folder).join(file_header.file_name().trim_start_matches('/'));
let mut output_path = Path::new(&output_folder).join(file_header.file_name().trim_start_matches('/'));
let output_path_parent = output_path.parent().expect("Failed to get parent of the output path!");
//prevent collisions because philips is dumb
if output_path_parent.exists() && output_path_parent.is_file() {
let fixed_file_name = if let Some((a, b)) = file_header.file_name().rsplit_once('/') {
format!("{}_{}", a, b)
} else {
file_header.file_name()
};
output_path = Path::new(&output_folder).join(file_header.file_name().trim_start_matches('/'));
println!("[!] Warning: File collision detected, this file will be saved to: {}", fixed_file_name);
}
if let Some(parent) = output_path.parent() {
fs::create_dir_all(parent)?;
+2 -1
View File
@@ -75,7 +75,8 @@ pub static EPK2: &[(&str, &str)] = &[
//github.com/openlgtv/epk2extract
pub static EPK3: &[(&str, &str)] = &[
("34CC219D3AFC102433109BBC1DA44095", "m14 (m14tv) - LX webOS 1 (2014)"),
("52A208FA24E7E70730A40999B1C22C148F4920484BC50B515D243E35D14689F1", "o24n - LX webOS 10 (2025)")
("74514676D68B9A72A0093CEF56D3067484E1F4D5CF7D4B4ED389BED030FA1B09", "k7lp - Realtek webOS 6 (2021)"),
("52A208FA24E7E70730A40999B1C22C148F4920484BC50B515D243E35D14689F1", "o24n - LX webOS 10 (2025)"),
];
//pana dvd keys (no AES)