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);
|
||||
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);
|
||||
var newName = newFile.leafName;
|
||||
newFile.remove(null);
|
||||
|
|
Loading…
Reference in a new issue