Default to creatorType: "author" if missing
Apparently in 4.0 we defaulted to 'author' if a creatorType wasn't
passed. To avoid lots of errors like the one fixed in
dd0094893a
,
add a similar fallback for 5.0 and log a warning (though not with the
translator name, unfortunately).
This commit is contained in:
parent
97f5c41aff
commit
c631bc4257
|
@ -101,6 +101,7 @@ Zotero.Translate.ItemSaver.prototype = {
|
||||||
} else {
|
} else {
|
||||||
newItem = new Zotero.Item(type);
|
newItem = new Zotero.Item(type);
|
||||||
newItem.libraryID = this._libraryID;
|
newItem.libraryID = this._libraryID;
|
||||||
|
if (item.creators) this._cleanCreators(item.creators);
|
||||||
if(item.tags) item.tags = this._cleanTags(item.tags);
|
if(item.tags) item.tags = this._cleanTags(item.tags);
|
||||||
|
|
||||||
// Need to handle these specially. Put them in a separate object to
|
// Need to handle these specially. Put them in a separate object to
|
||||||
|
@ -652,6 +653,15 @@ Zotero.Translate.ItemSaver.prototype = {
|
||||||
return myNote;
|
return myNote;
|
||||||
}),
|
}),
|
||||||
|
|
||||||
|
_cleanCreators: function (creators) {
|
||||||
|
creators.forEach(creator => {
|
||||||
|
if (!creator.creatorType) {
|
||||||
|
Zotero.warn(".creatorType missing in creator -- update translator code");
|
||||||
|
creator.creatorType = "author";
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove automatic tags if automatic tags pref is on, and set type
|
* Remove automatic tags if automatic tags pref is on, and set type
|
||||||
* to automatic if forced
|
* to automatic if forced
|
||||||
|
|
Loading…
Reference in New Issue
Block a user