Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update EpubMetadataImageProvider.cs #66

Merged
merged 1 commit into from
Aug 31, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -91,34 +91,34 @@ await coverStream.CopyToAsync(memoryStream)
return response;
}

private Task<DynamicImageResponse> GetFromZip(BaseItem item)
private async Task<DynamicImageResponse> GetFromZip(BaseItem item)
{
using var epub = ZipFile.OpenRead(item.Path);

var opfFilePath = EpubUtils.ReadContentFilePath(epub);
if (opfFilePath == null)
{
return Task.FromResult(new DynamicImageResponse { HasImage = false });
return new DynamicImageResponse { HasImage = false };
}

var opfRootDirectory = Path.GetDirectoryName(opfFilePath);
if (string.IsNullOrEmpty(opfRootDirectory))
{
return Task.FromResult(new DynamicImageResponse { HasImage = false });
return new DynamicImageResponse { HasImage = false };
}

var opfFile = epub.GetEntry(opfFilePath);
if (opfFile == null)
{
return Task.FromResult(new DynamicImageResponse { HasImage = false });
return new DynamicImageResponse { HasImage = false };
}

using var opfStream = opfFile.Open();

var opfDocument = new XmlDocument();
opfDocument.Load(opfStream);

return LoadCover(epub, opfDocument, opfRootDirectory);
return await LoadCover(epub, opfDocument, opfRootDirectory).ConfigureAwait(false);
}
}
}