mirror of https://github.com/kiwix/libkiwix.git
Fool-proof checking of book illustration presence
Now (in a library.xml flow) a book is considered to contain an illustration only if both "faviconMimeType" and "favicon" attributes are set to non-empty values.
This commit is contained in:
parent
f25d287afa
commit
f41007989b
|
@ -117,11 +117,12 @@ void Book::updateFromXml(const pugi::xml_node& node, const std::string& baseDir)
|
|||
m_articleCount = strtoull(ATTR("articleCount"), 0, 0);
|
||||
m_mediaCount = strtoull(ATTR("mediaCount"), 0, 0);
|
||||
m_size = strtoull(ATTR("size"), 0, 0) << 10;
|
||||
std::string favicon_mimetype = ATTR("faviconMimeType");
|
||||
if (! favicon_mimetype.empty()) {
|
||||
const std::string faviconMimeType = ATTR("faviconMimeType");
|
||||
const std::string faviconBase64EncodedData = ATTR("favicon");
|
||||
if ( !faviconMimeType.empty() && !faviconBase64EncodedData.empty() ) {
|
||||
const auto favicon = std::make_shared<Illustration>();
|
||||
favicon->data = base64_decode(ATTR("favicon"));
|
||||
favicon->mimeType = favicon_mimetype;
|
||||
favicon->data = base64_decode(faviconBase64EncodedData);
|
||||
favicon->mimeType = faviconMimeType;
|
||||
favicon->url = ATTR("faviconUrl");
|
||||
m_illustrations.assign(1, favicon);
|
||||
}
|
||||
|
|
|
@ -144,9 +144,7 @@ std::string maskVariableOPDSFeedData(std::string s)
|
|||
"wikipedia_ru_ray_charles",\
|
||||
"",\
|
||||
"public_tag_with_a_value:value_of_a_public_tag;_private_tag_with_a_value:value_of_a_private_tag;wikipedia;_pictures:no;_videos:no;_details:no",\
|
||||
"<link rel=\"http://opds-spec.org/image/thumbnail\"\n" \
|
||||
" href=\"/ROOT%23%3F/catalog/v2/illustration/raycharles_uncategorized/?size=48\"\n" \
|
||||
" type=\"image/png;favicon_attribute_is_absent;width=48;height=48;scale=1\"/>\n ", \
|
||||
"",\
|
||||
"zimfile", \
|
||||
"zimfile", \
|
||||
"125952"\
|
||||
|
|
Loading…
Reference in New Issue