From 2bd862777b7707faef4ba9e8703c7cd0dd26f489 Mon Sep 17 00:00:00 2001
From: ricterz <ricterzheng@gmail.com>
Date: Fri, 20 Sep 2024 23:53:26 +0800
Subject: [PATCH] fix #333

---
 nhentai/utils.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/nhentai/utils.py b/nhentai/utils.py
index 434bcb0..a081d57 100644
--- a/nhentai/utils.py
+++ b/nhentai/utils.py
@@ -209,9 +209,10 @@ def generate_pdf(output_dir='.', doujinshi_obj=None, rm_origin_dir=False, move_t
         """Write images to a PDF file using img2pdf."""
         if doujinshi_obj is not None:
             doujinshi_dir = os.path.join(output_dir, doujinshi_obj.filename)
+            filename = doujinshi_obj.filename.replace('/', '-')
             pdf_filename = os.path.join(
                 os.path.join(doujinshi_dir, '..'),
-                f'{doujinshi_obj.filename}.pdf'
+                f'{filename}.pdf'
             )
         else:
             pdf_filename = './doujinshi.pdf'