From e40049ca0ae03066a0f89010f64bc2a30cd669f5 Mon Sep 17 00:00:00 2001 From: tonymushah Date: Mon, 9 Oct 2023 14:50:41 +0300 Subject: [PATCH] fixed : serde_json error on chapter download --- Cargo.lock | 2 +- Cargo.toml | 2 +- src/download/chapter.rs | 3 +++ 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 2b5f93f..0f82747 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1271,7 +1271,7 @@ dependencies = [ [[package]] name = "mangadex-desktop-api2" -version = "0.5.7-alpha.1" +version = "0.5.7-alpha.2" dependencies = [ "actix-cors", "actix-web", diff --git a/Cargo.toml b/Cargo.toml index 76509c7..ab6bc6f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "mangadex-desktop-api2" -version = "0.5.7-alpha.1" +version = "0.5.7-alpha.2" authors = ["tonymushah "] license = "MIT OR Apache-2.0" description = "A Actix server for downloading manga, chapters, covers from Mangadex" diff --git a/src/download/chapter.rs b/src/download/chapter.rs index 37570b9..b1ceeac 100644 --- a/src/download/chapter.rs +++ b/src/download/chapter.rs @@ -51,6 +51,7 @@ impl ChapterDownload { .dirs_options .chapters_add(format!("{}/data.json", id).as_str()); let http_client = self.http_client.lock().await.client.clone(); + log::info!("{path}"); task_manager.lock_spawn_with_data(async move { let get_chapter = http_client .get( @@ -68,7 +69,9 @@ impl ChapterDownload { let chapter_data = File::create((path).as_str())?; let mut writer = BufWriter::new(chapter_data.try_clone()?); writer.write_all(&bytes_)?; + log::info!("writed data"); writer.flush()?; + let chapter_data = File::open((path).as_str())?; Ok(serde_json::from_reader(BufReader::new(chapter_data))?) }).await? }