Fix non-integer userID in settings table

A submitted database had a text userID with a trailing "A0. Not sure how
that happened -- it doesn't appear to be possible in current code -- but
it caused group permissions not to be properly synced.
This commit is contained in:
Dan Stillman 2018-08-09 03:30:47 -04:00
parent 8d8109dbac
commit 26056c87f1
2 changed files with 11 additions and 1 deletions

View file

@ -2441,6 +2441,16 @@ Zotero.Schema = new function(){
}
}
else if (i == 102) {
let userID = yield Zotero.DB.valueQueryAsync("SELECT value FROM settings WHERE setting='account' AND key='userID'");
if (userID && typeof userID == 'string') {
userID = userID.trim();
if (userID) {
yield Zotero.DB.queryAsync("UPDATE settings SET value=? WHERE setting='account' AND key='userID'", parseInt(userID));
}
}
}
// If breaking compatibility or doing anything dangerous, clear minorUpdateFrom
}

View file

@ -1,4 +1,4 @@
-- 101
-- 102
-- Copyright (c) 2009 Center for History and New Media
-- George Mason University, Fairfax, Virginia, USA