From 3a1e9abd68f84b62f20a2b3b4c4b4e39cd386831 Mon Sep 17 00:00:00 2001 From: advplyr Date: Fri, 9 Aug 2024 16:41:52 -0500 Subject: [PATCH] Revert unicode sqlite extension to fix db corruption #3241 --- server/Database.js | 9 ++++----- server/managers/BinaryManager.js | 5 +++-- server/utils/queries/libraryItemsBookFilters.js | 2 +- server/utils/queries/libraryItemsPodcastFilters.js | 2 +- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/server/Database.js b/server/Database.js index 6fe058c6..ff8b0c7f 100644 --- a/server/Database.js +++ b/server/Database.js @@ -207,7 +207,6 @@ class Database { try { await this.sequelize.authenticate() - await this.loadExtensions([process.env.SQLEAN_UNICODE_PATH]) Logger.info(`[Database] Db connection was successful`) return true } catch (error) { @@ -217,7 +216,7 @@ class Database { } /** - * + * TODO: Temporarily disabled * @param {string[]} extensions paths to extension binaries */ async loadExtensions(extensions) { @@ -827,7 +826,7 @@ class Database { } /** - * + * TODO: Temporarily unused * @param {string} value * @returns {string} */ @@ -836,7 +835,7 @@ class Database { } /** - * + * TODO: Temporarily unused * @param {string} query * @returns {Promise} */ @@ -855,7 +854,7 @@ class Database { */ matchExpression(column, normalizedQuery) { const normalizedPattern = this.sequelize.escape(`%${normalizedQuery}%`) - const normalizedColumn = this.normalize(column) + const normalizedColumn = column return `${normalizedColumn} LIKE ${normalizedPattern}` } } diff --git a/server/managers/BinaryManager.js b/server/managers/BinaryManager.js index dbb90477..0e9353cf 100644 --- a/server/managers/BinaryManager.js +++ b/server/managers/BinaryManager.js @@ -263,8 +263,9 @@ module.exports.sqlean = sqlean // for testing class BinaryManager { defaultRequiredBinaries = [ new Binary('ffmpeg', 'executable', 'FFMPEG_PATH', ['5.1'], ffbinaries), // ffmpeg executable - new Binary('ffprobe', 'executable', 'FFPROBE_PATH', ['5.1'], ffbinaries), // ffprobe executable - new Binary('unicode', 'library', 'SQLEAN_UNICODE_PATH', ['0.24.2'], sqlean) // sqlean unicode extension + new Binary('ffprobe', 'executable', 'FFPROBE_PATH', ['5.1'], ffbinaries) // ffprobe executable + // TODO: Temporarily disabled due to db corruption issues + // new Binary('unicode', 'library', 'SQLEAN_UNICODE_PATH', ['0.24.2'], sqlean) // sqlean unicode extension ] constructor(requiredBinaries = this.defaultRequiredBinaries) { diff --git a/server/utils/queries/libraryItemsBookFilters.js b/server/utils/queries/libraryItemsBookFilters.js index f41c3c99..57f7f554 100644 --- a/server/utils/queries/libraryItemsBookFilters.js +++ b/server/utils/queries/libraryItemsBookFilters.js @@ -975,7 +975,7 @@ module.exports = { async search(oldUser, oldLibrary, query, limit, offset) { const userPermissionBookWhere = this.getUserPermissionBookWhereQuery(oldUser) - const normalizedQuery = await Database.getNormalizedQuery(query) + const normalizedQuery = query const matchTitle = Database.matchExpression('title', normalizedQuery) const matchSubtitle = Database.matchExpression('subtitle', normalizedQuery) diff --git a/server/utils/queries/libraryItemsPodcastFilters.js b/server/utils/queries/libraryItemsPodcastFilters.js index 464bd7ed..85ac74f6 100644 --- a/server/utils/queries/libraryItemsPodcastFilters.js +++ b/server/utils/queries/libraryItemsPodcastFilters.js @@ -314,7 +314,7 @@ module.exports = { async search(oldUser, oldLibrary, query, limit, offset) { const userPermissionPodcastWhere = this.getUserPermissionPodcastWhereQuery(oldUser) - const normalizedQuery = await Database.getNormalizedQuery(query) + const normalizedQuery = query const matchTitle = Database.matchExpression('title', normalizedQuery) const matchAuthor = Database.matchExpression('author', normalizedQuery)