Fix a couple issues that could cause an error when emptying the trash
This commit is contained in:
parent
e17bdd85e9
commit
3014263c89
1 changed files with 13 additions and 1 deletions
|
@ -3973,7 +3973,19 @@ Zotero.Item.prototype.erase = function() {
|
|||
}
|
||||
|
||||
Zotero.DB.query('DELETE FROM itemData WHERE itemID=?', this.id);
|
||||
Zotero.DB.query('DELETE FROM items WHERE itemID=?', this.id);
|
||||
|
||||
try {
|
||||
Zotero.DB.query('DELETE FROM items WHERE itemID=?', this.id);
|
||||
}
|
||||
catch (e) {
|
||||
// If deletion fails, try to correct a few things that have come up before
|
||||
Zotero.debug("Item deletion failed -- trying to fix", 2);
|
||||
Zotero.DB.query('DELETE FROM fulltextItemWords WHERE itemID=?', this.id);
|
||||
Zotero.DB.query('DELETE FROM itemTags WHERE itemID=?', this.id);
|
||||
|
||||
// And then try again
|
||||
Zotero.DB.query('DELETE FROM items WHERE itemID=?', this.id);
|
||||
}
|
||||
|
||||
try {
|
||||
Zotero.DB.commitTransaction();
|
||||
|
|
Loading…
Reference in a new issue