Fix a few potential attachment errors
This commit is contained in:
parent
1e42abb5e4
commit
91b2fb99f1
|
@ -2166,6 +2166,7 @@ Zotero.Item.prototype.getFile = function(row, skipExistsCheck) {
|
||||||
}
|
}
|
||||||
catch (e) {
|
catch (e) {
|
||||||
Zotero.debug('Invalid persistent descriptor');
|
Zotero.debug('Invalid persistent descriptor');
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2191,6 +2192,7 @@ Zotero.Item.prototype.getFile = function(row, skipExistsCheck) {
|
||||||
}
|
}
|
||||||
catch (e) {
|
catch (e) {
|
||||||
Zotero.debug('Invalid relative descriptor');
|
Zotero.debug('Invalid relative descriptor');
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1569,6 +1569,22 @@ Zotero.Schema = new function(){
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (keys[id]) {
|
if (keys[id]) {
|
||||||
|
var renameTarget = storage37.clone();
|
||||||
|
renameTarget.append(keys[id]);
|
||||||
|
if (renameTarget.exists()) {
|
||||||
|
if (!orphaned.exists()) {
|
||||||
|
orphaned.create(Components.interfaces.nsIFile.DIRECTORY_TYPE, 0755);
|
||||||
|
}
|
||||||
|
var target = orphaned.clone();
|
||||||
|
target.append(keys[id]);
|
||||||
|
var newName = null;
|
||||||
|
if (target.exists()) {
|
||||||
|
target.createUnique(Components.interfaces.nsIFile.NORMAL_FILE_TYPE, 0644);
|
||||||
|
newName = target.leafName;
|
||||||
|
target.remove(null);
|
||||||
|
}
|
||||||
|
renameTarget.moveTo(orphaned, newName);
|
||||||
|
}
|
||||||
file.moveTo(null, keys[id]);
|
file.moveTo(null, keys[id]);
|
||||||
moveReport += keys[id] + ' ' + id + "\n";
|
moveReport += keys[id] + ' ' + id + "\n";
|
||||||
}
|
}
|
||||||
|
@ -1576,7 +1592,15 @@ Zotero.Schema = new function(){
|
||||||
if (!orphaned.exists()) {
|
if (!orphaned.exists()) {
|
||||||
orphaned.create(Components.interfaces.nsIFile.DIRECTORY_TYPE, 0755);
|
orphaned.create(Components.interfaces.nsIFile.DIRECTORY_TYPE, 0755);
|
||||||
}
|
}
|
||||||
file.moveTo(orphaned, null);
|
var target = orphaned.clone();
|
||||||
|
target.append(file.leafName);
|
||||||
|
var newName = null;
|
||||||
|
if (target.exists()) {
|
||||||
|
target.createUnique(Components.interfaces.nsIFile.NORMAL_FILE_TYPE, 0644);
|
||||||
|
newName = target.leafName;
|
||||||
|
target.remove(null);
|
||||||
|
}
|
||||||
|
file.moveTo(orphaned, newName);
|
||||||
}
|
}
|
||||||
movedFiles37[id] = file;
|
movedFiles37[id] = file;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user