From 8c97c93b34954ca227e7c7f704dc7105ae6c1f4f Mon Sep 17 00:00:00 2001
From: Neshura <neshura@neshweb.net>
Date: Tue, 18 Feb 2025 22:36:48 +0100
Subject: [PATCH] Bugfix: epub file was removed before processing of chapters
 was done

---
 main.go | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/main.go b/main.go
index 5b27b30..923c4e1 100644
--- a/main.go
+++ b/main.go
@@ -434,8 +434,8 @@ func DownloadAndProcessEpub(jnovel jnc.Api, serie jnc.SerieAugmented, volume jnc
 				epub.Close()
 				newZip.Close()
 				newZipFile.Close()
-				os.Remove(file)
 			}
+			os.Remove(file)
 		}
 	case "novel":
 		{
@@ -822,6 +822,9 @@ func GenerateMangaChapterList(navigation FileWrapper) *list.List {
 			r, _ := regexp.Compile(regex)
 			num := r.FindStringSubmatch(label)[1]
 			parse, _ := strconv.ParseInt(num, 10, 8)
+			if parse == 0 {
+				fmt.Printf("Unlikely Chapter Number Detected (0): %s/n", label)
+			}
 			lastMainChapter = int8(parse)
 			subChapter = int8(0)
 		} else {