- Fix error when dragging item with missing child attachment to another library
- Fix another cross-library problem (which may or may not have been exposed) that showed up in testing
This commit is contained in:
parent
a91bffd25a
commit
36a876021d
|
@ -1110,8 +1110,8 @@ Zotero.Attachments = new function(){
|
||||||
}
|
}
|
||||||
newAttachment.save();
|
newAttachment.save();
|
||||||
|
|
||||||
// Copy over files
|
// Copy over files if they exist
|
||||||
if (newAttachment.isImportedAttachment()) {
|
if (newAttachment.isImportedAttachment() && attachment.getFile()) {
|
||||||
var dir = Zotero.Attachments.getStorageDirectory(attachment.id);
|
var dir = Zotero.Attachments.getStorageDirectory(attachment.id);
|
||||||
var newDir = Zotero.Attachments.createDirectoryForItem(newAttachment.id);
|
var newDir = Zotero.Attachments.createDirectoryForItem(newAttachment.id);
|
||||||
Zotero.File.copyDirectory(dir, newDir);
|
Zotero.File.copyDirectory(dir, newDir);
|
||||||
|
|
|
@ -112,15 +112,14 @@ Zotero.Relations = new function () {
|
||||||
predicate = _getPrefixAndValue(predicate).join(':');
|
predicate = _getPrefixAndValue(predicate).join(':');
|
||||||
|
|
||||||
var relation = new Zotero.Relation;
|
var relation = new Zotero.Relation;
|
||||||
|
if (!libraryID) {
|
||||||
|
libraryID = Zotero.libraryID;
|
||||||
|
}
|
||||||
if (libraryID) {
|
if (libraryID) {
|
||||||
relation.libraryID = parseInt(libraryID);
|
relation.libraryID = parseInt(libraryID);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
libraryID = Zotero.libraryID;
|
relation.libraryID = "local/" + Zotero.getLocalUserKey(true);
|
||||||
if (!libraryID) {
|
|
||||||
libraryID = Zotero.getLocalUserKey(true);
|
|
||||||
}
|
|
||||||
relation.libraryID = parseInt(libraryID);
|
|
||||||
}
|
}
|
||||||
relation.subject = subject;
|
relation.subject = subject;
|
||||||
relation.predicate = predicate;
|
relation.predicate = predicate;
|
||||||
|
|
|
@ -184,6 +184,9 @@ Zotero.File = new function(){
|
||||||
* Copies all files from dir into newDir
|
* Copies all files from dir into newDir
|
||||||
*/
|
*/
|
||||||
this.copyDirectory = function (dir, newDir) {
|
this.copyDirectory = function (dir, newDir) {
|
||||||
|
if (!dir.exists()) {
|
||||||
|
throw ("Directory doesn't exist in Zotero.File.copyDirectory()");
|
||||||
|
}
|
||||||
var otherFiles = dir.directoryEntries;
|
var otherFiles = dir.directoryEntries;
|
||||||
while (otherFiles.hasMoreElements()) {
|
while (otherFiles.hasMoreElements()) {
|
||||||
var file = otherFiles.getNext();
|
var file = otherFiles.getNext();
|
||||||
|
|
Loading…
Reference in New Issue
Block a user