Mendeley import: Import folders with parentId of 0 instead of -1

Top-level folders should have a parentId of -1, but at least in one user
report there's a folder with 0.
This commit is contained in:
Dan Stillman 2018-06-27 02:19:00 +02:00
parent f715c02a66
commit 3aefcdf2d9

View file

@ -195,7 +195,11 @@ Zotero_Import_Mendeley.prototype._isValidDatabase = async function () {
//
Zotero_Import_Mendeley.prototype._getFolders = async function (groupID) {
return this._db.queryAsync(
`SELECT F.*, RF.remoteUuid FROM Folders F `
`SELECT F.id, F.uuid, F.name, `
// Top-level folders can have a parentId of 0 instead of -1 (by mistake?)
+ `CASE WHEN F.parentId=0 THEN -1 ELSE F.parentId END AS parentId, `
+ `RF.remoteUuid `
+ `FROM Folders F `
+ `JOIN RemoteFolders RF ON (F.id=RF.folderId) `
+ `WHERE groupId=?`,
groupID