mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-05-23 17:19:37 +02:00
Merge pull request #9973 from overleaf/em-duplicate-filenames-conflict
Fix the automatic fixing of duplicate filenames GitOrigin-RevId: 8ecdeb22c0c7f3c28983d4bf0f50c573193703b4
This commit is contained in:
@@ -1522,6 +1522,26 @@ const ProjectEntityUpdateHandler = {
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
// Avoid conflicts by processing renames in the reverse order. If we have
|
||||
// the following starting situation:
|
||||
//
|
||||
// somefile.tex
|
||||
// somefile.tex
|
||||
// somefile.tex (1)
|
||||
//
|
||||
// somefile.tex would be processed first, and then somefile.tex (1),
|
||||
// yielding the following renames:
|
||||
//
|
||||
// somefile.tex -> somefile.tex (1)
|
||||
// somefile.tex (1) -> somefile.tex (2)
|
||||
//
|
||||
// When the first rename was decided, we didn't know that somefile.tex (1)
|
||||
// existed, so that created a conflict. By processing renames in the
|
||||
// reverse order, we start with the files that had the most extensive
|
||||
// information about existing files.
|
||||
renames.reverse()
|
||||
|
||||
async.eachSeries(renames, doRename, callback)
|
||||
},
|
||||
|
||||
|
||||
Reference in New Issue
Block a user