mirror of https://github.com/kiwix/libkiwix.git
Do not create a dummy illustration if library.xml doesn't contain one.
Fix #644
This commit is contained in:
parent
d29611ed75
commit
22e5327dcf
13
src/book.cpp
13
src/book.cpp
|
@ -123,11 +123,14 @@ 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;
|
||||
const auto favicon = std::make_shared<Illustration>();
|
||||
favicon->data = base64_decode(ATTR("favicon"));
|
||||
favicon->mimeType = ATTR("faviconMimeType");
|
||||
favicon->url = ATTR("faviconUrl");
|
||||
m_illustrations.assign(1, favicon);
|
||||
std::string favicon_mimetype = ATTR("faviconMimeType");
|
||||
if (! favicon_mimetype.empty()) {
|
||||
const auto favicon = std::make_shared<Illustration>();
|
||||
favicon->data = base64_decode(ATTR("favicon"));
|
||||
favicon->mimeType = favicon_mimetype;
|
||||
favicon->url = ATTR("faviconUrl");
|
||||
m_illustrations.assign(1, favicon);
|
||||
}
|
||||
try {
|
||||
m_downloadId = ATTR("downloadId");
|
||||
} catch(...) {}
|
||||
|
|
|
@ -15,12 +15,10 @@
|
|||
<tags>{{tags}}</tags>
|
||||
<articleCount>{{article_count}}</articleCount>
|
||||
<mediaCount>{{media_count}}</mediaCount>
|
||||
{{#icons}}
|
||||
<link rel="http://opds-spec.org/image/thumbnail"
|
||||
{{#icons}}<link rel="http://opds-spec.org/image/thumbnail"
|
||||
href="/meta?name=Illustration_{{icon_width}}x{{icon_height}}@{{icon_scale}}&content={{{content_id}}}"
|
||||
type="image/png;width={{icon_width}};height={{icon_height}};scale={{icon_scale}}"/>
|
||||
{{/icons}}
|
||||
<link type="text/html" href="/{{{content_id}}}" />
|
||||
{{/icons}}<link type="text/html" href="/{{{content_id}}}" />
|
||||
<author>
|
||||
<name>{{author_name}}</name>
|
||||
</author>
|
||||
|
|
|
@ -14,6 +14,8 @@
|
|||
articleCount="284"
|
||||
mediaCount="2"
|
||||
size="556"
|
||||
faviconMimeType="image/png"
|
||||
favicon="SOME DATA"
|
||||
></book>
|
||||
<book
|
||||
id="raycharles_uncategorized"
|
||||
|
|
|
@ -659,9 +659,6 @@ std::string maskVariableOPDSFeedData(std::string s)
|
|||
" <tags>unittest;wikipedia;_category:jazz;_pictures:no;_videos:no;_details:no;_ftindex:yes</tags>\n" \
|
||||
" <articleCount>284</articleCount>\n" \
|
||||
" <mediaCount>2</mediaCount>\n" \
|
||||
" <link rel=\"http://opds-spec.org/image/thumbnail\"\n" \
|
||||
" href=\"/meta?name=Illustration_48x48@1&content=zimfile\"\n" \
|
||||
" type=\"image/png;width=48;height=48;scale=1\"/>\n" \
|
||||
" <link type=\"text/html\" href=\"/zimfile\" />\n" \
|
||||
" <author>\n" \
|
||||
" <name>Wikipedia</name>\n" \
|
||||
|
@ -711,9 +708,6 @@ std::string maskVariableOPDSFeedData(std::string s)
|
|||
" <tags>unittest;wikipedia;_pictures:no;_videos:no;_details:no</tags>\n" \
|
||||
" <articleCount>284</articleCount>\n" \
|
||||
" <mediaCount>2</mediaCount>\n" \
|
||||
" <link rel=\"http://opds-spec.org/image/thumbnail\"\n" \
|
||||
" href=\"/meta?name=Illustration_48x48@1&content=zimfile\"\n" \
|
||||
" type=\"image/png;width=48;height=48;scale=1\"/>\n" \
|
||||
" <link type=\"text/html\" href=\"/zimfile\" />\n" \
|
||||
" <author>\n" \
|
||||
" <name>Wikipedia</name>\n" \
|
||||
|
|
Loading…
Reference in New Issue