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 70cdb5e56e
commit 6f9079a341

View file

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