diff --git a/src/main.rs b/src/main.rs index 42d5382..293ec75 100644 --- a/src/main.rs +++ b/src/main.rs @@ -60,7 +60,7 @@ async fn main() { Ok(desktop) => { for item in desktop.items { let mut path = ilias.opt.output.clone(); - path.push(item.name()); + path.push(file_escape(item.name())); let ilias = Arc::clone(&ilias); task::spawn(process_gracefully(ilias, path, item)); } @@ -187,7 +187,7 @@ fn process(ilias: Arc, mut path: PathBuf, obj: Object) -> impl Future, mut path: PathBuf, obj: Object) -> impl Future, mut path: PathBuf, obj: Object) -> impl Future, mut path: PathBuf, obj: Object) -> impl Future().replace('/', "-").trim() + link.text().collect::().trim() ); - path.push(name); + path.push(file_escape(&name)); // TODO: set modification date? let saved_posts = { match std::fs::read_dir(&path) { // TODO: make this async @@ -399,7 +399,7 @@ fn process(ilias: Arc, mut path: PathBuf, obj: Object) -> impl Future, mut path: PathBuf, obj: Object) -> impl Future().trim().to_owned(); let item = File { url, name }; let mut path = path.clone(); - path.push(item.name()); + path.push(file_escape(item.name())); let ilias = Arc::clone(&ilias); task::spawn(process_gracefully(ilias, path, item)); } @@ -489,7 +489,7 @@ fn process(ilias: Arc, mut path: PathBuf, obj: Object) -> impl Future String { + s.replace('/', "-").replace('\\', "-") +}