mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-10-26 16:45:09 +00:00
Backport pull request #18283 from jellyfin/release-12.z
Fix EPUB metadata and covers not loading on Windows
Original-merge: 56989b0c80
Merged-by: crobibero <cody@robibe.ro>
Backported-by: Cody Robibero <cody@robibe.ro>
This commit is contained in:
1 parent
35cee77a98
commit
f89279fc4b
4 files changed
+38
-3
No files matched your search
@@ -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));
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user