Add a safeguard into Zotero.Attachments.getStorageDirectory(itemID) to make sure it returns an actual item directory

This commit is contained in:
Dan Stillman 2009-05-21 14:27:36 +00:00
parent a150c134bc
commit b8599d0414

View file

@ -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;