[BE][Scans] Fixes #35. Rename file when there's an error detecting a QR

master
Araozu 2023-12-05 15:39:43 -05:00
parent 78ddd5a1f9
commit 99b02f30a2
1 changed files with 13 additions and 1 deletions

View File

@ -212,7 +212,19 @@ fn get_image_info(path: PathBuf) -> ScanInfo {
Err(reason) => { Err(reason) => {
log::error!("Error decoding qr: {:?}", reason); log::error!("Error decoding qr: {:?}", reason);
// Here there was a problem aligning the QR. Assume no QR // Here there was a problem aligning the QR. Assume no QR
return ScanInfo::Empty(current_ms.to_string());
// Rename the file
let mut new_path = path.clone();
new_path.set_file_name(format!("eeg_{}.jpg", current_ms));
return match fs::rename(path, new_path) {
Ok(_) => ScanInfo::Empty(current_ms.to_string()),
Err(err) => {
log::error!("Error renombrando archivo: {:?}", err);
ScanInfo::Error("Error renombrando archivo.".into())
}
}
} }
}; };