From 438f708cc8ca480ebf07c742ca7c8587831a77a4 Mon Sep 17 00:00:00 2001 From: Chris Laine Date: Wed, 8 Jan 2025 11:40:36 +1300 Subject: [PATCH 1/2] Only add new chapter to Epub if one with the same absolute path doesn't already exist --- EpubCore/EpubReader.cs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/EpubCore/EpubReader.cs b/EpubCore/EpubReader.cs index 07b997f..8237f33 100644 --- a/EpubCore/EpubReader.cs +++ b/EpubCore/EpubReader.cs @@ -169,7 +169,12 @@ private static List LoadChaptersFromNav(string navAbsolutePath, XEl { chapter.SubChapters = LoadChaptersFromNav(navAbsolutePath, li, bookResources, chapter); } - result.Add(chapter); + + // If we don't already have a chapter with this absolute path, then add it. Otherwise, ignore it. + if (result.FirstOrDefault(x => x.AbsolutePath.Equals(chapter.AbsolutePath)) == null) + { + result.Add(chapter); + } previous = chapter.SubChapters.Any() ? chapter.SubChapters.Last() : chapter; } From de340b4e7140903bfee8b4c3a0f9d7614d336266 Mon Sep 17 00:00:00 2001 From: Chris Laine Date: Wed, 8 Jan 2025 11:46:50 +1300 Subject: [PATCH 2/2] Updating packaged versions --- EpubCore.Cli/EpubCore.Cli.csproj | 4 ++-- EpubCore/EpubCore.csproj | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/EpubCore.Cli/EpubCore.Cli.csproj b/EpubCore.Cli/EpubCore.Cli.csproj index 0d40d9d..e3b7ff1 100644 --- a/EpubCore.Cli/EpubCore.Cli.csproj +++ b/EpubCore.Cli/EpubCore.Cli.csproj @@ -10,10 +10,10 @@ ../nupkg EpubCore.Cli EpubCore Cli - Copyright 2023 + Copyright 2025 https://github.com/domingoladron/EpubCore https://github.com/domingoladron/EpubCore - 0.9.2.0 + 0.9.3.0 diff --git a/EpubCore/EpubCore.csproj b/EpubCore/EpubCore.csproj index 9114acc..53acf20 100644 --- a/EpubCore/EpubCore.csproj +++ b/EpubCore/EpubCore.csproj @@ -7,16 +7,16 @@ Chris Laine (domingoladron) epub epubs book books 2.0 3.0 3.1 EpubCore - 1.6.1.0 + 1.6.2.0 A library for reading and writing EPUB files. https://github.com/domingoladron/EpubCore - Copyright 2023 - 1.6.1.0 - 1.6.1.0 + Copyright 2025 + 1.6.2.0 + 1.6.2.0 https://github.com/domingoladron/EpubCore git README.md - Adding logic to handle x-application font mime types + Fixing bug where too many Epub.Chapters generated True MPL-2.0