Tiny cleanup missing from previous commit

Had intended to apply it prior to pushing.
This commit is contained in:
Damien Elmes 2022-03-17 17:49:18 +10:00
parent 4687620f5e
commit 30e53c51ab

View File

@ -2,6 +2,7 @@
// License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html // License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
use std::{ use std::{
borrow::Cow,
collections::HashMap, collections::HashMap,
fs::{read_dir, DirEntry, File}, fs::{read_dir, DirEntry, File},
io::{self, Read, Write}, io::{self, Read, Write},
@ -288,11 +289,9 @@ fn normalized_unicode_file_name(entry: &DirEntry) -> Result<String> {
entry.file_name().to_string_lossy() entry.file_name().to_string_lossy()
)) ))
})?; })?;
if let Some(filename) = filename_if_normalized(filename) { filename_if_normalized(filename)
Ok(filename.into_owned()) .map(Cow::into_owned)
} else { .ok_or(AnkiError::MediaCheckRequired)
Err(AnkiError::MediaCheckRequired)
}
} }
/// Writes media files while compressing according to the targeted version. /// Writes media files while compressing according to the targeted version.