mirror of
https://github.com/zotero/zotero.git
synced 2026-09-17 23:51:18 +00:00
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…
Add table
Reference in a new issue