Seeding: sort files by path (#663)
Fixes a bug where you could create duplicate torrents by adding the same folder multiple times, because the file order & therefore the infohash was nondeterministic
This commit is contained in:
@@ -756,6 +756,7 @@ function findFilesRecursive (paths, cb) {
|
|||||||
findFilesRecursive([path], function (fileObjs) {
|
findFilesRecursive([path], function (fileObjs) {
|
||||||
ret = ret.concat(fileObjs)
|
ret = ret.concat(fileObjs)
|
||||||
if (++numComplete === paths.length) {
|
if (++numComplete === paths.length) {
|
||||||
|
ret.sort((a, b) => a.path < b.path ? -1 : a.path > b.path)
|
||||||
cb(ret)
|
cb(ret)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user