don't try to read file data when file marked as a deletion

If the user hadn't used the media check to clean up files with
invalid names on disk,  the long filename would break the 'automatically
rename long filenames when syncing' functionality, causing the original
long filename to be uploaded to AnkiWeb as an addition instead of
a deletion
This commit is contained in:
Damien Elmes 2020-03-10 09:29:36 +10:00
parent 78dd812f94
commit 18cd841246

View File

@ -712,13 +712,18 @@ fn zip_files<'a>(
break; break;
} }
let file_data = match data_for_file(media_folder, &file.fname) { let file_data = if file.sha1.is_some() {
Ok(data) => data, match data_for_file(media_folder, &file.fname) {
Err(e) => { Ok(data) => data,
debug!(log, "error accessing {}: {}", &file.fname, e); Err(e) => {
invalid_entries.push(&file.fname); debug!(log, "error accessing {}: {}", &file.fname, e);
continue; invalid_entries.push(&file.fname);
continue;
}
} }
} else {
// uploading deletion
None
}; };
if let Some(data) = &file_data { if let Some(data) = &file_data {