copyToUnique: Fail if source contains destination
To prevent unbounded recursion as in 16547f64c2
.
This commit is contained in:
parent
16547f64c2
commit
e271b4e494
1 changed files with 4 additions and 0 deletions
|
@ -999,6 +999,10 @@ Zotero.File = new function(){
|
||||||
file = this.pathToFile(file);
|
file = this.pathToFile(file);
|
||||||
newFile = this.pathToFile(newFile);
|
newFile = this.pathToFile(newFile);
|
||||||
|
|
||||||
|
if (file.contains(newFile)) {
|
||||||
|
throw new Error("Can't copy file into itself");
|
||||||
|
}
|
||||||
|
|
||||||
newFile.createUnique(Components.interfaces.nsIFile.NORMAL_FILE_TYPE, 0o644);
|
newFile.createUnique(Components.interfaces.nsIFile.NORMAL_FILE_TYPE, 0o644);
|
||||||
var newName = newFile.leafName;
|
var newName = newFile.leafName;
|
||||||
newFile.remove(null);
|
newFile.remove(null);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue