mirror of
https://github.com/flibusta-apps/books_downloader.git
synced 2025-12-06 06:55:37 +01:00
Remove not ascii chars in filename
This commit is contained in:
@@ -75,6 +75,8 @@ pub fn get_filename_by_book(book: &BookWithRemote, file_type: &str, force_zip: b
|
||||
let replace_transliterator = Transliterator::new(replace_char_map);
|
||||
let normal_filename = replace_transliterator.convert(&filename_without_type, false);
|
||||
|
||||
let normal_filename = normal_filename.replace(|c: char| !c.is_ascii(), "");
|
||||
|
||||
let right_part = format!(".{book_id}.{file_type_}");
|
||||
let normal_filename_slice = std::cmp::min(64 - right_part.len() - 1, normal_filename.len());
|
||||
let left_part = normal_filename.get(..normal_filename_slice).unwrap();
|
||||
|
||||
Reference in New Issue
Block a user