From 0ad459812876ca76186e9157afca0d2e7480e240 Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Sun, 27 Nov 2016 15:40:34 -0500 Subject: [PATCH] Fix DB backup (broken by 5a6f1eef6) --- chrome/content/zotero/xpcom/db.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/chrome/content/zotero/xpcom/db.js b/chrome/content/zotero/xpcom/db.js index 4c28c37a60..bcebdef048 100644 --- a/chrome/content/zotero/xpcom/db.js +++ b/chrome/content/zotero/xpcom/db.js @@ -1016,7 +1016,7 @@ Zotero.DBConnection.prototype.backupDatabase = Zotero.Promise.coroutine(function if (DB_LOCK_EXCLUSIVE) { yield this.queryAsync("PRAGMA locking_mode=NORMAL", false, { inBackup: true }); } - storageService.backupDatabaseFile(file, tmpFile.leafName, file.parent); + storageService.backupDatabaseFile(file, OS.Path.basename(tmpFile), file.parent); } catch (e) { Zotero.debug(e); @@ -1031,12 +1031,12 @@ Zotero.DBConnection.prototype.backupDatabase = Zotero.Promise.coroutine(function // Open the backup to check for corruption try { - var connection = storageService.openDatabase(tmpFile); + var connection = storageService.openDatabase(Zotero.File.pathToFile(tmpFile)); } catch (e) { - this._debug("Database file '" + tmpFile.leafName + "' is corrupt -- skipping backup"); - if (yield OS.File.exists(tmpFile.path)) { - yield OS.File.remove(tmpFile.path); + this._debug("Database file '" + OS.Path.basename(tmpFile) + "' is corrupt -- skipping backup"); + if (yield OS.File.exists(tmpFile)) { + yield OS.File.remove(tmpFile); } return false; } @@ -1091,7 +1091,7 @@ Zotero.DBConnection.prototype.backupDatabase = Zotero.Promise.coroutine(function OS.File.remove(backupFile); } - yield OS.File.move(tmpFile.path, backupFile); + yield OS.File.move(tmpFile, backupFile); Zotero.debug("Backed up to " + OS.Path.basename(backupFile)); return true;