aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorchino <chino@users.noreply.github.com>2026-10-05 19:19:09 -0400
committerCody Robibero <cody@robibe.ro>2026-10-05 19:19:09 -0400
commitf89279fc4bd33d47623284ad337d3bc5aa6dd282 (patch)
tree6aa659b807f0e71abb59a4e2e08a8957addd91fd /tests
parent35cee77a983c8448cdae0e26e530699820e2f022 (diff)
Backport pull request #18283 from jellyfin/release-12.z
Fix EPUB metadata and covers not loading on Windows Original-merge: 56989b0c8057275b38805ab977e1f1fa7c6d3e95 Merged-by: crobibero <cody@robibe.ro> Backported-by: Cody Robibero <cody@robibe.ro>
Diffstat (limited to 'tests')
-rw-r--r--tests/Jellyfin.Providers.Tests/Books/EpubUtilsTests.cs34
1 files changed, 34 insertions, 0 deletions
diff --git a/tests/Jellyfin.Providers.Tests/Books/EpubUtilsTests.cs b/tests/Jellyfin.Providers.Tests/Books/EpubUtilsTests.cs
new file mode 100644
index 0000000000..a5a3af6210
--- /dev/null
+++ b/tests/Jellyfin.Providers.Tests/Books/EpubUtilsTests.cs
@@ -0,0 +1,34 @@
+using System.IO;
+using System.IO.Compression;
+using System.Text;
+using MediaBrowser.Providers.Books.OpenPackagingFormat;
+using Xunit;
+
+namespace Jellyfin.Providers.Tests.Books;
+
+public class EpubUtilsTests
+{
+ [Fact]
+ public void ReadContentFilePath_ReadsRootFileFromContainer()
+ {
+ using var stream = new MemoryStream();
+ using (var archive = new ZipArchive(stream, ZipArchiveMode.Create, true))
+ {
+ using var writer = new StreamWriter(archive.CreateEntry("META-INF/container.xml").Open(), Encoding.UTF8);
+ writer.Write(
+ """
+ <?xml version="1.0"?>
+ <container version="1.0" xmlns="urn:oasis:names:tc:opendocument:xmlns:container">
+ <rootfiles>
+ <rootfile full-path="OEBPS/content.opf" media-type="application/oebps-package+xml"/>
+ </rootfiles>
+ </container>
+ """);
+ }
+
+ stream.Position = 0;
+ using var epub = new ZipArchive(stream, ZipArchiveMode.Read);
+
+ Assert.Equal("OEBPS/content.opf", EpubUtils.ReadContentFilePath(epub));
+ }
+}