mirror of
https://github.com/zadam/trilium.git
synced 2026-05-06 12:26:21 +02:00
fix(server): prevent NaN potentially corrupting the backup when migrating
This commit is contained in:
@@ -397,7 +397,8 @@
|
||||
"migration": {
|
||||
"old_version": "Direct migration from your current version is not supported. Please upgrade to the latest v0.60.4 first and only then to this version.",
|
||||
"error_message": "Error during migration to version {{version}}: {{stack}}",
|
||||
"wrong_db_version": "The version of the database ({{version}}) is newer than what the application expects ({{targetVersion}}), which means that it was created by a newer and incompatible version of Trilium. Upgrade to the latest version of Trilium to resolve this issue."
|
||||
"wrong_db_version": "The version of the database ({{version}}) is newer than what the application expects ({{targetVersion}}), which means that it was created by a newer and incompatible version of Trilium. Upgrade to the latest version of Trilium to resolve this issue.",
|
||||
"invalid_db_version": "The database version is not a valid number. This usually indicates a corrupted 'dbVersion' option in the database. Please restore from a backup."
|
||||
},
|
||||
"modals": {
|
||||
"error_title": "Error"
|
||||
|
||||
@@ -130,6 +130,11 @@ function isDbUpToDate() {
|
||||
async function migrateIfNecessary() {
|
||||
const currentDbVersion = getDbVersion();
|
||||
|
||||
if (isNaN(currentDbVersion)) {
|
||||
await crash(t("migration.invalid_db_version"));
|
||||
return;
|
||||
}
|
||||
|
||||
if (currentDbVersion > appInfo.dbVersion && process.env.TRILIUM_IGNORE_DB_VERSION !== "true") {
|
||||
await crash(t("migration.wrong_db_version", { version: currentDbVersion, targetVersion: appInfo.dbVersion }));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user