Add a safeguard into Zotero.Attachments.getStorageDirectory(itemID) to make sure it returns an actual item directory
This commit is contained in:
parent
a150c134bc
commit
b8599d0414
1 changed files with 3 additions and 0 deletions
|
@ -967,6 +967,9 @@ Zotero.Attachments = new function(){
|
|||
|
||||
function getStorageDirectory(itemID) {
|
||||
var item = Zotero.Items.get(itemID);
|
||||
if (!item) {
|
||||
throw ("Item " + itemID + " not found in Zotero.Attachments.getStorageDirectory()");
|
||||
}
|
||||
var dir = Zotero.getStorageDirectory();
|
||||
dir.append(item.key);
|
||||
return dir;
|
||||
|
|
Loading…
Reference in a new issue