diff --git a/plugins/Lumina.Plugins.Calibre/Core/CalibreArtworkProvider.cs b/plugins/Lumina.Plugins.Calibre/Core/CalibreArtworkProvider.cs index e3ffd5e3..557bf102 100644 --- a/plugins/Lumina.Plugins.Calibre/Core/CalibreArtworkProvider.cs +++ b/plugins/Lumina.Plugins.Calibre/Core/CalibreArtworkProvider.cs @@ -38,30 +38,30 @@ internal sealed class CalibreArtworkProvider : IArtworkProvider /// The lookup describing the book to get the cover for. /// Cancellation token that can be used to stop the execution. - /// The cover of the book, or when no cover was found. - public Task GetArtworkAsync(BookMetadataLookupDto lookup, CancellationToken cancellationToken) + /// The cover of the book, or an empty collection when no cover was found. + public Task> GetArtworkAsync(BookMetadataLookupDto lookup, CancellationToken cancellationToken) { if (string.IsNullOrWhiteSpace(lookup.Path)) - return Task.FromResult(null); + return Task.FromResult>([]); string bookDirectory = Path.GetDirectoryName(lookup.Path) ?? string.Empty; string opfFilePath = Path.Combine(bookDirectory, "metadata.opf"); if (!File.Exists(opfFilePath)) - return Task.FromResult(null); + return Task.FromResult>([]); OpfDocumentDto document = OpfReader.Read(opfFilePath); if (string.IsNullOrWhiteSpace(document.CoverHref)) - return Task.FromResult(null); + return Task.FromResult>([]); // the cover reference must be a bare file name contained in the directory of the book, so that no file outside of it can be accessed string coverFileName = Path.GetFileName(document.CoverHref); if (coverFileName != document.CoverHref || Path.IsPathRooted(document.CoverHref)) - return Task.FromResult(null); + return Task.FromResult>([]); string coverFilePath = Path.Combine(bookDirectory, coverFileName); if (!File.Exists(coverFilePath)) - return Task.FromResult(null); + return Task.FromResult>([]); - return Task.FromResult(new ArtworkDto(LocalPath: coverFilePath, RemoteUrl: null)); + return Task.FromResult>([new ArtworkDto(ArtworkType.Cover, Ordinal: 0, LocalPath: coverFilePath, RemoteUrl: null)]); } }