mirror of https://github.com/kiwix/libkiwix.git
Do not store the favicon base64 encoded in the book.
The fact that the favicon is base64 encoded in a storage detail.
This commit is contained in:
parent
c7f9218350
commit
57fbb98bca
|
@ -268,7 +268,7 @@ bool Library::writeToFile(const std::string& path) {
|
||||||
bookNode.append_attribute("publisher") = book.publisher().c_str();
|
bookNode.append_attribute("publisher") = book.publisher().c_str();
|
||||||
|
|
||||||
if (!book.favicon().empty())
|
if (!book.favicon().empty())
|
||||||
bookNode.append_attribute("favicon") = book.favicon().c_str();
|
bookNode.append_attribute("favicon") = base64_encode(book.favicon()).c_str();
|
||||||
|
|
||||||
if (!book.faviconMimeType().empty())
|
if (!book.faviconMimeType().empty())
|
||||||
bookNode.append_attribute("faviconMimeType")
|
bookNode.append_attribute("faviconMimeType")
|
||||||
|
|
|
@ -46,6 +46,7 @@ bool Manager::parseXmlDom(const pugi::xml_document& doc,
|
||||||
kiwix::Book book;
|
kiwix::Book book;
|
||||||
|
|
||||||
book.setReadOnly(readOnly);
|
book.setReadOnly(readOnly);
|
||||||
|
book.setFavicon(base64_decode(bookNode.attribute("favicon").value());
|
||||||
book.setId(bookNode.attribute("id").value());
|
book.setId(bookNode.attribute("id").value());
|
||||||
std::string path = bookNode.attribute("path").value();
|
std::string path = bookNode.attribute("path").value();
|
||||||
if (isRelativePath(path)) {
|
if (isRelativePath(path)) {
|
||||||
|
@ -73,7 +74,6 @@ bool Manager::parseXmlDom(const pugi::xml_document& doc,
|
||||||
book.setArticleCount(strtoull(bookNode.attribute("articleCount").value(), 0, 0));
|
book.setArticleCount(strtoull(bookNode.attribute("articleCount").value(), 0, 0));
|
||||||
book.setMediaCount(strtoull(bookNode.attribute("mediaCount").value(), 0, 0));
|
book.setMediaCount(strtoull(bookNode.attribute("mediaCount").value(), 0, 0));
|
||||||
book.setSize(strtoull(bookNode.attribute("size").value(), 0, 0));
|
book.setSize(strtoull(bookNode.attribute("size").value(), 0, 0));
|
||||||
book.setFavicon(bookNode.attribute("favicon").value());
|
|
||||||
book.setFaviconMimeType(bookNode.attribute("faviconMimeType").value());
|
book.setFaviconMimeType(bookNode.attribute("faviconMimeType").value());
|
||||||
|
|
||||||
/* Update the book properties with the new importer */
|
/* Update the book properties with the new importer */
|
||||||
|
@ -135,7 +135,7 @@ bool Manager::parseOpdsDom(const pugi::xml_document& doc, const std::string& url
|
||||||
auto fileHandle = downloader.download(faviconUrl);
|
auto fileHandle = downloader.download(faviconUrl);
|
||||||
if (fileHandle.success) {
|
if (fileHandle.success) {
|
||||||
auto content = getFileContent(fileHandle.path);
|
auto content = getFileContent(fileHandle.path);
|
||||||
book.setFavicon(base64_encode(content));
|
book.setFavicon(content);
|
||||||
book.setFaviconMimeType(linkNode.attribute("type").value());
|
book.setFaviconMimeType(linkNode.attribute("type").value());
|
||||||
} else {
|
} else {
|
||||||
std::cerr << "Cannot get favicon content from " << faviconUrl << std::endl;
|
std::cerr << "Cannot get favicon content from " << faviconUrl << std::endl;
|
||||||
|
|
Loading…
Reference in New Issue