Поправлен баг - неверно определялся тип обложки
This commit is contained in:
@@ -70,9 +70,6 @@ class Fb2Helper {
|
|||||||
if (coverImage.count) {
|
if (coverImage.count) {
|
||||||
const coverAttrs = coverImage.attrs();
|
const coverAttrs = coverImage.attrs();
|
||||||
const href = coverAttrs[`${parser.xlinkNS}:href`];
|
const href = coverAttrs[`${parser.xlinkNS}:href`];
|
||||||
let coverType = coverAttrs['content-type'];
|
|
||||||
coverType = (coverType == 'image/jpg' || coverType == 'application/octet-stream' ? 'image/jpeg' : coverType);
|
|
||||||
coverExt = (coverType == 'image/png' ? '.png' : '.jpg');
|
|
||||||
|
|
||||||
if (href) {
|
if (href) {
|
||||||
const binaryId = (href[0] == '#' ? href.substring(1) : href);
|
const binaryId = (href[0] == '#' ? href.substring(1) : href);
|
||||||
@@ -84,6 +81,10 @@ class Fb2Helper {
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
if (attrs.id === binaryId) {
|
if (attrs.id === binaryId) {
|
||||||
|
let coverType = attrs['content-type'];
|
||||||
|
coverType = (coverType == 'image/jpg' || coverType == 'application/octet-stream' ? 'image/jpeg' : coverType);
|
||||||
|
coverExt = (coverType == 'image/png' ? '.png' : '.jpg');
|
||||||
|
|
||||||
const base64 = node.text();
|
const base64 = node.text();
|
||||||
cover = (base64 ? Buffer.from(base64, 'base64') : null);
|
cover = (base64 ? Buffer.from(base64, 'base64') : null);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user