Поправка мелкого бага

This commit is contained in:
Book Pauk
2022-11-18 20:45:38 +07:00
parent b8b40e8cb0
commit e685f136e1

View File

@@ -469,14 +469,14 @@ class WebWorker {
const bookFile = `${this.config.filesDir}/${hash}`;
const bookFileInfo = `${bookFile}.i.json`;
const restoreBookInfo = async(info) => {
const result = {};
let rows = await db.select({table: 'book', where: `@@hash('_uid', ${db.esc(bookUid)})`});
if (!rows.length)
throw new Error('404 Файл не найден');
const book = rows[0];
const restoreBookInfo = async(info) => {
const result = {};
result.book = book;
result.cover = '';
result.fb2 = false;
@@ -493,7 +493,8 @@ class WebWorker {
}
}
Object.assign(info ,result);
Object.assign(info, result);
await fs.writeFile(bookFileInfo, JSON.stringify(info));
if (this.config.branch === 'development') {
@@ -513,7 +514,7 @@ class WebWorker {
if (tmpInfo.cover)
coverFile = `${this.config.publicFilesDir}${tmpInfo.cover}`;
if (coverFile && !await fs.pathExists(coverFile)) {
if (book.id != tmpInfo.book.id || (coverFile && !await fs.pathExists(coverFile))) {
await restoreBookInfo(bookInfo);
} else {
bookInfo = tmpInfo;